From dc3d98ab47fefc8388455dbbd4d330e81499d95a Mon Sep 17 00:00:00 2001 From: BoredGuy Date: Thu, 24 Jul 2025 20:37:56 -0700 Subject: Initial Commit --- src/game.c | 38 ++++++++++++++++++++++++++++++++++++++ src/main.c | 21 +++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/game.c create mode 100644 src/main.c (limited to 'src') diff --git a/src/game.c b/src/game.c new file mode 100644 index 0000000..eeabb4d --- /dev/null +++ b/src/game.c @@ -0,0 +1,38 @@ +#include +#include +#include "game.h" + +Game game; + +static inline bool EntityAllocated(const Entity* e) { + return (e->flags & ENTITY_ALLOCATED); +} + +void AddEntity(Entity* e) { + static int nextId = 0; + + e->id = nextId++; + e->flags |= ENTITY_ALLOCATED; + + for(int i = 0; i < MAX_ENTITY_COUNT; i++) { + if (!EntityAllocated(&game.entities[i])) { + game.entities[i] = *e; + } + } +} + +void InitGame() { + game.paused = false; + + memset(game.entities, 0, sizeof(game.entities)); +} + +void UpdateGame(float deltaTime) { + (void)deltaTime; +} + +void DrawGame() { + BeginDrawing(); + ClearBackground(RAYWHITE); + EndDrawing(); +} \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..f01f61c --- /dev/null +++ b/src/main.c @@ -0,0 +1,21 @@ +#include +#include +#include "constants.h" +#include "game.h" + +int main() { + SetConfigFlags(FLAG_VSYNC_HINT); //Always better than fixed FPS imo + InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "My BeatEmup"); + SetTargetFPS(0); + + InitGame(); + + while(!WindowShouldClose()) { + UpdateGame(GetFrameTime()); + + DrawGame(); + } + + CloseWindow(); + return 0; +} \ No newline at end of file -- cgit v1.2.3