mirror of
https://gitlab.com/octospacc/MultiSpaccSDK
synced 2025-06-05 22:09:21 +02:00
Move fuctions in topic-files, less monolithic ifdefs, update Makefile, README
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
AppName = $(notdir ${CURDIR})
|
||||
Sources = $(wildcard *.c ../../LibMultiSpacc/*.c)
|
||||
CFlags = -O2 -Wpedantic -Werror
|
||||
AppSources = $(wildcard *.c)
|
||||
AppHeaders = $(wildcard *.h)
|
||||
SpaccSources = $(wildcard ../../LibMultiSpacc/*.c)
|
||||
SpaccHeaders = $(wildcard ../../LibMultiSpacc/*.h)
|
||||
CFlags = -Os -Wpedantic -Werror
|
||||
|
||||
# Default build is always for the host system
|
||||
ifndef Target
|
||||
@ -23,6 +26,9 @@ ifdef Target
|
||||
else ifeq ($(Target), NDS)
|
||||
Defines += -DTarget_NDS
|
||||
MultiSpacc_Target = NDS
|
||||
else ifeq ($(Target), NES)
|
||||
Defines += -DTarget_NES
|
||||
MultiSpacc_Target = NES
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -30,21 +36,23 @@ ifeq ($(MultiSpacc_Target), SDL12)
|
||||
Defines += -DMultiSpacc_Target_SDL12 -DMultiSpacc_Target_SDLCom
|
||||
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)
|
||||
BuildProcess = Normal
|
||||
else ifeq ($(MultiSpacc_Target), SDL20)
|
||||
Defines += -DMultiSpacc_Target_SDL20 -DMultiSpacc_Target_SDLCom
|
||||
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)
|
||||
BuildProcess = Normal
|
||||
else ifeq ($(MultiSpacc_Target), NDS)
|
||||
Defines += -DMultiSpacc_Target_NDS
|
||||
BuildProcess = NDS
|
||||
else ifeq ($(MultiSpacc_Target), NES)
|
||||
Defines += -DMultiSpacc_Target_NES
|
||||
BuildProcess = NES
|
||||
endif
|
||||
|
||||
CC = $(ToolsPrefix)gcc $(CFlags) $(Defines)
|
||||
Objects = $(Sources:.c=.o)
|
||||
BuildSources = $(AppSources) $(SpaccSources)
|
||||
Objects = $(BuildSources:.c=.o)
|
||||
|
||||
All all: $(BuildProcess)
|
||||
|
||||
@ -55,18 +63,17 @@ NDS:
|
||||
$(eval VirtualBuildDir = ./Build/NDS)
|
||||
mkdir -p $(VirtualBuildDir)/source/.tmp
|
||||
cp ../NDS.mk $(VirtualBuildDir)/Makefile
|
||||
cp $(Sources) $(VirtualBuildDir)/source/
|
||||
cp $(wildcard ../../LibMultiSpacc/*.*) $(VirtualBuildDir)/source/.tmp/
|
||||
# rm of the last file is temporary fix for a strange file duplication bug
|
||||
cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv $$i ../LibMultiSpacc_$$i; done; rm ../MultiSpacc.c #
|
||||
#cp $(wildcard ../../LibMultiSpacc/NDS/*.*) $(VirtualBuildDir)/source/.tmp/
|
||||
#cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv $$i ../LibMultiSpacc_NDS_$$i; done
|
||||
cp $(SpaccSources) $(SpaccHeaders) $(VirtualBuildDir)/source/.tmp/
|
||||
cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv ./$$i ../LibMultiSpacc_$$i; done
|
||||
cp $(AppSources) $(AppHeaders) $(VirtualBuildDir)/source/
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"../../LibMultiSpacc/|#include "LibMultiSpacc_|g' $$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"../MultiSpacc|#include "LibMultiSpacc_MultiSpacc|g' $$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"NDS/|#include "LibMultiSpacc_NDS_|g' $$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"./|#include "./LibMultiSpacc_|g' $$i; done
|
||||
cd $(VirtualBuildDir); make
|
||||
|
||||
NES:
|
||||
#
|
||||
|
||||
Run run: All
|
||||
./$(AppName)$(ExeSuffix)
|
||||
|
||||
|
@ -4,6 +4,11 @@
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
int spriteX = 0;
|
||||
int spriteY = 0;
|
||||
int accelX = +2;
|
||||
int accelY = +2;
|
||||
|
||||
MultiSpacc_SurfaceConfig WindowConfig = { .Width = 320, .Height = 240, .Bits = 16 };
|
||||
MultiSpacc_Window *Window = MultiSpacc_SetWindow( WindowConfig );
|
||||
MultiSpacc_Surface *Screen = MultiSpacc_GetWindowSurface( Window );
|
||||
@ -20,13 +25,41 @@ int main( int argc, char *argv[] )
|
||||
// Copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT)
|
||||
MultiSpacc_Surface *TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL );
|
||||
MultiSpacc_PrintText( "Hello, World!", Screen, WindowConfig, 0, 0, TilesImg );
|
||||
MultiSpacc_PrintDebug("[I] Ready!\n");
|
||||
|
||||
if( MultiSpacc_UpdateWindowSurface( Window ) != 0 )
|
||||
// if( MultiSpacc_UpdateWindowSurface(Window) != 0 )
|
||||
// {
|
||||
// MultiSpacc_PrintDebug("[E] Error Updating Screen.\n");
|
||||
// return -1;
|
||||
// };
|
||||
|
||||
while(true)
|
||||
{
|
||||
MultiSpacc_PrintDebug("[E] Error Updating Screen.\n");
|
||||
return -1;
|
||||
};
|
||||
MultiSpacc_Sprite( 0, spriteX, spriteY, 0x80, TilesImg, Screen );
|
||||
|
||||
MultiSpacc_Sleep( 4000 );
|
||||
spriteX += accelX;
|
||||
spriteY += accelY;
|
||||
|
||||
if( spriteX >= WindowConfig.Width )
|
||||
{
|
||||
spriteX = 0;
|
||||
}
|
||||
|
||||
if( spriteY == 0 || spriteY == (WindowConfig.Height - 8) )
|
||||
{
|
||||
accelY *= -1;
|
||||
}
|
||||
|
||||
if( MultiSpacc_UpdateWindowSurface(Window) != 0 )
|
||||
{
|
||||
MultiSpacc_PrintDebug("[E] Error Updating Screen.\n");
|
||||
return -1;
|
||||
};
|
||||
|
||||
// TODO: Implement cross-platform vblank-wait
|
||||
MultiSpacc_Sleep(16);
|
||||
}
|
||||
|
||||
//MultiSpacc_Sleep(4000);
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 664 B |
Reference in New Issue
Block a user