refactored app.h from main
This commit is contained in:
@@ -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
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef APPLICATIONSTATE_H
|
#ifndef APPLICATIONSTATE_H
|
||||||
#define APPLICATIONSTATE_H
|
#define APPLICATIONSTATE_H
|
||||||
|
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Screen currentScreen;
|
Screen currentScreen;
|
||||||
bool running;
|
bool running;
|
||||||
|
|||||||
+6
-32
@@ -1,42 +1,16 @@
|
|||||||
#include <raylib.h>
|
#include <raylib.h>
|
||||||
#include "../include/raymath.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "engine/screen.h"
|
#include "../include/raymath.h"
|
||||||
#include "engine/display.h"
|
#include "app.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;
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
Display display = {
|
|
||||||
.name = "The Last Hive",
|
|
||||||
.width = 1280,
|
|
||||||
.height = 720
|
|
||||||
};
|
|
||||||
|
|
||||||
InitWindow(display.width, display.height, display.name);
|
|
||||||
InitAudioDevice();
|
|
||||||
|
|
||||||
Application app;
|
Application app;
|
||||||
app.state.currentScreen = LOGO;
|
InitApp(&app);
|
||||||
app.state.running = true;
|
|
||||||
app.state.gameStarted = false;
|
InitWindow(app.display.width, app.display.height, app.display.name);
|
||||||
app.state.flagFPS = true;
|
InitAudioDevice();
|
||||||
app.display = display;
|
|
||||||
app.font = LoadFont("assets/SproutLandsUI/fonts/pixelFont-7-8x14-sproutLands.fnt");
|
|
||||||
|
|
||||||
SetTextureFilter(app.font.texture, TEXTURE_FILTER_POINT);
|
SetTextureFilter(app.font.texture, TEXTURE_FILTER_POINT);
|
||||||
SetTraceLogLevel(LOG_NONE);
|
SetTraceLogLevel(LOG_NONE);
|
||||||
|
|||||||
Reference in New Issue
Block a user