summaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
authorBoredGuy <osome3717@gmail.com>2025-07-24 20:37:56 -0700
committerBoredGuy <osome3717@gmail.com>2025-07-24 20:37:56 -0700
commitdc3d98ab47fefc8388455dbbd4d330e81499d95a (patch)
tree39edca664d3aca027181a9aa567d8e81775e8c2a /src/game.c
Initial Commit
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c38
1 files changed, 38 insertions, 0 deletions
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 <raylib.h>
+#include <string.h>
+#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