summaryrefslogtreecommitdiff
path: root/src/game.c
blob: eeabb4d0108dd0f6f96ad17d419a6d6fe03f76f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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();
}