blob: ee4dee95927d33ddb47128711b8979237368812e (
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
|
#include <stdio.h>
#include <string.h>
#include "game.h"
struct game game;
void update_game(float dt) {
for (int i = 0; i < MAX_ENTITY_COUNT; i++) {
struct entity* current = &game.entities[i];
if (!entity_active(current))
continue;
update_entity(current, dt);
}
}
void draw_game() {
for (int i = 0; i < MAX_ENTITY_COUNT; i++) {
const struct entity* current = &game.entities[i];
//Skip inactive entities
if (!entity_active(current))
continue;
draw_entity(current);
}
}
void init_game() {
memset(&game, 0, sizeof(struct game));
}
|