diff --git a/src/app.h b/src/app.h new file mode 100644 index 0000000..f03ceb3 --- /dev/null +++ b/src/app.h @@ -0,0 +1,33 @@ +#ifndef APP_H +#define APP_H + +#include "engine/applicationstate.h" +#include "engine/display.h" +#include "engine/screen.h" +#include "game/logo.h" +#include "game/menu.h" +#include "game/game.h" + +typedef struct { + State state; + Display display; + Font font; + LogoState logo; + GameState game; + MenuState menu; +} Application; + +void InitApp(Application* app){ + app->state.currentScreen = LOGO; + app->state.running = true; + app->state.gameStarted = false; + app->state.flagFPS = true; + app->display = (Display){ + .name = "The Last Hive", + .width = 1280, + .height = 720 + }; + app->font = LoadFont("assets/SproutLandsUI/fonts/pixelFont-7-8x14-sproutLands.fnt"); +} + +#endif //APP_H diff --git a/src/engine/applicationstate.h b/src/engine/applicationstate.h index 89335f4..532b1ad 100644 --- a/src/engine/applicationstate.h +++ b/src/engine/applicationstate.h @@ -1,6 +1,8 @@ #ifndef APPLICATIONSTATE_H #define APPLICATIONSTATE_H +#include "screen.h" + typedef struct { Screen currentScreen; bool running; diff --git a/src/main.c b/src/main.c index 168b15f..a255b3f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,42 +1,16 @@ #include -#include "../include/raymath.h" #include #include -#include "engine/screen.h" -#include "engine/display.h" -#include "engine/applicationstate.h" -#include "game/logo.h" -#include "game/menu.h" -#include "game/game.h" - -typedef struct { - State state; - Display display; - Font font; - LogoState logo; - GameState game; - MenuState menu; -} Application; +#include "../include/raymath.h" +#include "app.h" int main(void) { - - Display display = { - .name = "The Last Hive", - .width = 1280, - .height = 720 - }; - - InitWindow(display.width, display.height, display.name); - InitAudioDevice(); - Application app; - app.state.currentScreen = LOGO; - app.state.running = true; - app.state.gameStarted = false; - app.state.flagFPS = true; - app.display = display; - app.font = LoadFont("assets/SproutLandsUI/fonts/pixelFont-7-8x14-sproutLands.fnt"); + InitApp(&app); + + InitWindow(app.display.width, app.display.height, app.display.name); + InitAudioDevice(); SetTextureFilter(app.font.texture, TEXTURE_FILTER_POINT); SetTraceLogLevel(LOG_NONE);