intro function in Engine.c as opposed to its own include file
Derek Stevens 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-----
M
Engine.c
→
Engine.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;
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.c
→
main.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)