mirror of
https://gitlab.com/octospacc/MultiSpaccSDK
synced 2025-06-05 22:09:21 +02:00
Windows build support (MSYS2); Initial NDS support
This commit is contained in:
@ -1,44 +1,60 @@
|
||||
AppName = $(notdir ${CURDIR})
|
||||
Sources = $(wildcard *.c ../../LibMultiSpacc/*.c)
|
||||
CFlags = -O2
|
||||
CC = gcc $(Defines)
|
||||
CFlags = -O2 -Wpedantic -Werror
|
||||
|
||||
ifndef Target
|
||||
Target = PC
|
||||
ifeq ($(shell uname --operating-system), Msys)
|
||||
Target = WindowsPC
|
||||
else
|
||||
Target = LinuxPC
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef Target
|
||||
ifeq ($(Target), PC)
|
||||
ifeq ($(Target), LinuxPC)
|
||||
ExeSuffix = .run
|
||||
Defines = -DTarget_PC
|
||||
Defines += -DTarget_LinuxPC
|
||||
MultiSpacc_Target = SDL20
|
||||
else ifeq ($(Target), WindowsPC)
|
||||
ExeSuffix = .exe
|
||||
Defines += -DTarget_WindowsPC
|
||||
MultiSpacc_Target = SDL20
|
||||
else ifeq ($(Target), NDS)
|
||||
Defines += -DTarget_NDS
|
||||
MultiSpacc_Target = NDS
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MultiSpacc_Target), SDL12)
|
||||
Defines += -DMultiSpacc_Target_SDL12
|
||||
LdFlags += -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf
|
||||
CFlags += $(shell sdl-config --cflags)
|
||||
LdFlags += $(shell sdl-config --libs) -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf
|
||||
Sources += $(wildcard ../../LibMultiSpacc/SDLCom/*.c ../../LibMultiSpacc/SDL12/*.c)
|
||||
else ifeq ($(MultiSpacc_Target), SDL20)
|
||||
Defines += -DMultiSpacc_Target_SDL20
|
||||
LdFlags += -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
|
||||
CFlags += $(shell sdl2-config --cflags)
|
||||
LdFlags += $(shell sdl2-config --libs) -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
|
||||
Sources += $(wildcard ../../LibMultiSpacc/SDLCom/*.c ../../LibMultiSpacc/SDL20/*.c)
|
||||
else ifeq ($(MultiSpacc_Target), NDS)
|
||||
#include $(DEVKITARM)/ds_rules
|
||||
Defines += -DMultiSpacc_Target_NDS
|
||||
CFlags += -I$(DEVKITPRO)/libnds/include -DARM9
|
||||
Sources += $(wildcard ../../LibMultiSpacc/NDS/*.c)
|
||||
ToolsPrefix = $(DEVKITARM)/bin/arm-none-eabi-
|
||||
endif
|
||||
|
||||
CC = $(ToolsPrefix)gcc $(CFlags) $(Defines)
|
||||
Objects = $(Sources:.c=.o)
|
||||
|
||||
All: $(AppName)
|
||||
All all: $(AppName)
|
||||
|
||||
$(AppName): $(Objects)
|
||||
$(CC) $^ $(CFlags) $(LdFlags) -o $(AppName)$(ExeSuffix)
|
||||
$(CC) $^ $(LdFlags) -o $(AppName)$(ExeSuffix)
|
||||
|
||||
Run: All
|
||||
Run run: All
|
||||
./$(AppName)$(ExeSuffix)
|
||||
|
||||
Clean:
|
||||
Clean clean:
|
||||
find -L . -name "*.o" -type f -delete
|
||||
find -L ../../LibMultiSpacc -name "*.o" -type f -delete
|
||||
rm -f $(AppName)$(ExeSuffix) $(AppName).*$(ExeSuffix)
|
||||
|
||||
all: All
|
||||
run: Run
|
||||
clean: Clean
|
||||
|
BIN
LibMultiSpacc/Examples/HelloWorld/HelloWorld
Normal file
BIN
LibMultiSpacc/Examples/HelloWorld/HelloWorld
Normal file
Binary file not shown.
@ -1,18 +1,16 @@
|
||||
#include "../../LibMultiSpacc/MultiSpacc.h"
|
||||
|
||||
#define AppName "Hello World"
|
||||
#define ScreenWidth 320
|
||||
#define ScreenHeight 240
|
||||
#define ScreenBits 16
|
||||
|
||||
int main( int argc, char *args[] )
|
||||
{
|
||||
MultiSpacc_Window *Window = MultiSpacc_SetWindow( ScreenWidth, ScreenHeight, ScreenBits, 0 );
|
||||
MultiSpacc_SurfaceConfig WindowConfig = { .Width = 320, .Height = 240, .Bits = 16 };
|
||||
MultiSpacc_Window *Window = MultiSpacc_SetWindow( WindowConfig );
|
||||
MultiSpacc_Surface *Screen = MultiSpacc_GetWindowSurface( Window );
|
||||
|
||||
if( Screen == NULL )
|
||||
{
|
||||
printf("[E] Error initializing Video System.\n");
|
||||
printf("[E] Error Initializing Video System.\n");
|
||||
return -1;
|
||||
};
|
||||
|
||||
@ -22,28 +20,14 @@ int main( int argc, char *args[] )
|
||||
// Copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT)
|
||||
MultiSpacc_Surface *TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL );
|
||||
|
||||
/*char Text[] = "Hello, World!";
|
||||
for(int i = 0; i < sizeof( Text ); i++){
|
||||
MultiSpacc_Rect Offset = {
|
||||
.x = (8 * i) + (ScreenWidth / sizeof( Text )),
|
||||
.y = ScreenHeight / 3,
|
||||
};
|
||||
MultiSpacc_Rect Clip = {
|
||||
.x = 8 * (Text[i] % 16),
|
||||
.y = 8 * (Text[i] / 16),
|
||||
.w = 8,
|
||||
.h = 8,
|
||||
};
|
||||
SDL_BlitSurface( TilesImg, &Clip, Screen, &Offset );
|
||||
};*/
|
||||
MultiSpacc_PrintString( "Hello, World!", Screen, ScreenWidth, ScreenHeight, 4, 4, TilesImg );
|
||||
MultiSpacc_PrintText( "Hello, World!", Screen, WindowConfig.Width, WindowConfig.Height, 4, 4, TilesImg );
|
||||
|
||||
if( MultiSpacc_UpdateWindowSurface( Window ) != 0 )
|
||||
{
|
||||
printf("[E] Error updating Screen.\n");
|
||||
printf("[E] Error Updating Screen.\n");
|
||||
return -1;
|
||||
};
|
||||
|
||||
MultiSpacc_Sleep( 3000 );
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user