Slight reconstruction/abstraction. Getting close to connecting to other sessions etc.
This commit is contained in:
21
src/main.c
21
src/main.c
@@ -6,6 +6,9 @@
|
||||
#include "presentation/states/state_main_menu.h"
|
||||
|
||||
#include "raylib.h"
|
||||
#include "session/networking.h"
|
||||
|
||||
#include "instance/game_instance.h"
|
||||
|
||||
int main() {
|
||||
InitWindow(1280, 720, "snejk");
|
||||
@@ -14,10 +17,18 @@ int main() {
|
||||
|
||||
bool should_quit_game = false;
|
||||
|
||||
Presentation_State_Ingame_Context presentation_state_ingame_ctx = (Presentation_State_Ingame_Context) {
|
||||
};
|
||||
Game_Instance local_game_instance;
|
||||
memset(&local_game_instance, 0, sizeof(Game_Instance));
|
||||
|
||||
game_instance_init(&local_game_instance);
|
||||
|
||||
Presentation_State_Ingame_Context presentation_state_ingame_ctx;
|
||||
memset(&presentation_state_ingame_ctx, 0, sizeof(Presentation_State_Ingame_Context));
|
||||
|
||||
Presentation_State_Main_Menu_Context presentation_state_main_menu_ctx = {
|
||||
.should_quit_game = &should_quit_game,
|
||||
.game_instance = &local_game_instance,
|
||||
.ingame_ctx = &presentation_state_ingame_ctx
|
||||
};
|
||||
|
||||
presentation_state_ingame_init(&presentation_state_ingame_ctx);
|
||||
@@ -34,6 +45,10 @@ int main() {
|
||||
if(presentation_state_machine.current != NULL && presentation_state_machine.current->tick != NULL) {
|
||||
presentation_state_machine.current->tick(presentation_state_machine.current);
|
||||
}
|
||||
|
||||
if(IsKeyPressed(KEY_F)) {
|
||||
ToggleFullscreen();
|
||||
}
|
||||
|
||||
// Render.
|
||||
BeginDrawing();
|
||||
@@ -47,6 +62,8 @@ int main() {
|
||||
|
||||
assert(presentation_state_machine_go_to(NULL));
|
||||
CloseWindow();
|
||||
|
||||
game_instance_dispose(&local_game_instance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user