intro function in Engine.c as opposed to its own include file

This commit is contained in:
Iris Lightshard 2018-10-08 14:57:15 -07:00
parent bff466bba7
commit 4c5fc21951
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
4 changed files with 31 additions and 33 deletions

View file

@ -281,6 +281,34 @@ void cleanup()
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;

View file

@ -30,8 +30,8 @@ void timeDilation();
void cleanup();
void intro();
void mainmenu();
void filemenu();
void pausemenu();

25
intro.c
View file

@ -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);

7
main.c
View file

@ -70,12 +70,7 @@ int main (int argc, char* args[])
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)