learn-dlang/lesson#28 - Simple spritesh.../ourGame/source/app.d

48 lines
850 B
D

module app;
import game.data;
import game.gstatemanager;
import game.state.menu;
import game.state.play;
void main() {
validateRaylibBinding();
// init
InitWindow(windowWidth, windowHeight, "Mission X");
scope(exit) { CloseWindow(); }
// set frames per second
SetTargetFPS(60);
// declaring and initializing menu and play states
Menu menu = new Menu();
Play play = new Play();
// init GStateManager
GStateManager.getInstance.setState(GameState.MainMenu);
GStateManager.getInstance.add(menu, GameState.MainMenu);
GStateManager.getInstance.add(play, GameState.Play);
GStateManager.getInstance.add(null, GameState.Exit);
// game loop
while(!WindowShouldClose() && GStateManager.getInstance.getState != GameState.Exit) {
GStateManager.getInstance.execute();
}
}