From 4c5fc219516d2e8c75111f33f0f67bec9ded2e71 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Mon, 8 Oct 2018 14:57:15 -0700 Subject: [PATCH] intro function in Engine.c as opposed to its own include file --- Engine.c | 28 ++++++++++++++++++++++++++++ Engine.h | 4 ++-- intro.c | 25 ------------------------- main.c | 7 +------ 4 files changed, 31 insertions(+), 33 deletions(-) delete mode 100644 intro.c diff --git a/Engine.c b/Engine.c index 00dab7c..0d371ee 100644 --- a/Engine.c +++ b/Engine.c @@ -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; diff --git a/Engine.h b/Engine.h index 5e626a5..4776879 100644 --- a/Engine.h +++ b/Engine.h @@ -30,8 +30,8 @@ void timeDilation(); void cleanup(); +void intro(); + void mainmenu(); -void filemenu(); - void pausemenu(); diff --git a/intro.c b/intro.c deleted file mode 100644 index db82623..0000000 --- a/intro.c +++ /dev/null @@ -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); \ No newline at end of file diff --git a/main.c b/main.c index 7aafe26..22bfad8 100644 --- a/main.c +++ b/main.c @@ -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)