all repos — hyperkaos @ 4c5fc219516d2e8c75111f33f0f67bec9ded2e71

lightweight modular puzzle/adventure game engine in C with SDL 1.2

intro function in Engine.c as opposed to its own include file
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAlu70rwACgkQO3+8IhRO
Y5jPwA/+MrNy6u0qGSjgZyW9A+51V++ccWB8opPYF/w8e2V2k5Mrw1cRTaoEcXBv
4WFCkQYnp8fx4T4Y0XDr6Ad5BPRCjiQ8LC4X9XE61Mcye5N7TqC1n4iNDHK/OS3l
wH6YA22m1SO35yKDE7HVBoZPY+DhEMyYzRg30/ZWKPm1qffwLnsiCNZqX3uVTo5p
yAkk7kuPB5ZLYXQ13ldq4SGHFWeUTmKfYjO/xNtcPVNiuZ9R3GP0Vu5FqA9TgqG+
DiiBphxVXUVQfpZyUGnMc54pYDnCEvj3rfyIYWeG85gfGI+WvSxP0j/qcWqJk0hJ
i+z4rWwa8y5ksenLHcLrIYjW5NoSMHlg9fQcP2n8N7Xypn2G20F8oy0wdJW7f5k5
h7ObcBYXCot4Vfkthom/MIId2KgLx6ZdgO7lpyc/Ygq/CJcOXwvN1rsx32fQZWhe
IjAm8FrGmE942/KvsJwGTwxuVA39ui+MV5bpnNIEMDS6fVxuZWNaVHwHUVTkCVeN
1X/e/ZfoEOpCWgt75lM0wtTCIHYpYn/hMZ9aVsGlim9Hy+Tyq3yTHEqQ3Z3JbyhX
rzSPJQc3wt3DzOuRCc9nvpvP80ws4WP8T0jpEKKyjmhjPcycjD/5qMEArPQMxH2q
+fkPw0WD2+nrDLgehxlxUGZ6HlgDdVxu4FGKOzRxRUom2ZuGBMc=
=fgQh
-----END PGP SIGNATURE-----
commit

4c5fc219516d2e8c75111f33f0f67bec9ded2e71

parent

bff466bba7627f2f724663e6914951b8684f5b65

4 files changed, 31 insertions(+), 33 deletions(-)

jump to
M Engine.cEngine.c

@@ -281,6 +281,34 @@

printf("Cleanup complete\n"); } +void intro() +{ + SDL_Color black = {0,0,0}; + + SLayer* nebula = newSLayer(loadImage("assets/img/backgrounds/presents.png"), 0,0,0,0,255); + SLayer* fogF = newSLayer(loadImage("assets/img/fx/fog.png"), 0,0,-1,0,128); + SLayer* fogB = newSLayer(loadImage("assets/img/fx/plasma.png"), -320,0,1,0,56); + SLayer* presents = newSLayer(TTF_RenderText_Solid(font, "nilFM presents", textColor), 120,84,0,0,128); + + SLayer* menuTransition = newSLayer(loadImage("assets/img/backgrounds/mainmenu.png"),0,0,0,0,255); + + Scene* intro = newScene(30,30, 200, black, black); + Scene* transition = newScene(30,0,30, black, black); + + buildScene(intro, nebula); + buildScene(intro, fogB); + buildScene(intro, fogF); + buildScene(intro, presents); + + buildScene(transition, menuTransition); + + playScene(intro); + playScene(transition); + + deleteScene(intro); + deleteScene(transition); +} + void mainmenu() { int menucounter = 0;
M Engine.hEngine.h

@@ -30,8 +30,8 @@ void timeDilation();

void cleanup(); -void mainmenu(); +void intro(); -void filemenu(); +void mainmenu(); void pausemenu();
D intro.c

@@ -1,25 +0,0 @@

- - SDL_Color black = {0,0,0}; - - SLayer* nebula = newSLayer(loadImage("assets/img/backgrounds/presents.png"), 0,0,0,0,255); - SLayer* fogF = newSLayer(loadImage("assets/img/fx/fog.png"), 0,0,-1,0,128); - SLayer* fogB = newSLayer(loadImage("assets/img/fx/plasma.png"), -320,0,1,0,56); - SLayer* presents = newSLayer(TTF_RenderText_Solid(font, "nilFM presents", textColor), 120,84,0,0,128); - - SLayer* menuTransition = newSLayer(loadImage("assets/img/backgrounds/mainmenu.png"),0,0,0,0,255); - - Scene* intro = newScene(30,30, 200, black, black); - Scene* transition = newScene(30,0,30, black, black); - - buildScene(intro, nebula); - buildScene(intro, fogB); - buildScene(intro, fogF); - buildScene(intro, presents); - - buildScene(transition, menuTransition); - - playScene(intro); - playScene(transition); - - deleteScene(intro); - deleteScene(transition);
M main.cmain.c

@@ -70,12 +70,7 @@ printf("Init failed\n");

return 1; } - /* - * intro discarded immediately after playing, so instead of increasing the - * complexity and offloading it somewhere, we just keep it in this include - * file for cleanliness and modularity - */ - #include "intro.c" + intro(); // main game loop while (!quit)