Big initial commit: States, simulation, presentation, menus, some art.

This commit is contained in:
2025-12-10 23:12:19 +01:00
parent 0b0d920c84
commit 5a71d16d1f
49 changed files with 15852 additions and 0 deletions

53
src/main.c Normal file
View File

@@ -0,0 +1,53 @@
#include <stdlib.h>
#include <assert.h>
#include "presentation/states/state_ingame.h"
#include "presentation/states/state_main_menu.h"
#include "raylib.h"
int main() {
InitWindow(1280, 720, "snejk");
SetTargetFPS(60);
SetExitKey(KEY_NULL);
bool should_quit_game = false;
Presentation_State_Ingame_Context presentation_state_ingame_ctx = (Presentation_State_Ingame_Context) {
};
Presentation_State_Main_Menu_Context presentation_state_main_menu_ctx = {
.should_quit_game = &should_quit_game,
};
presentation_state_ingame_init(&presentation_state_ingame_ctx);
presentation_state_main_menu_init(&presentation_state_main_menu_ctx);
presentation_state_machine_go_to(&presentation_state_main_menu);
while(true) {
if(WindowShouldClose() || should_quit_game) {
break;
}
Presentation_State *state = presentation_state_machine.current;
// Tick.
if(state != NULL && state->tick != NULL) {
state->tick(state);
}
// Render.
BeginDrawing();
{
if(state != NULL && state->render != NULL) {
state->render(state);
}
}
EndDrawing();
}
assert(presentation_state_machine_go_to(NULL));
CloseWindow();
return 0;
}