summaryrefslogtreecommitdiff
path: root/src/entity.c
blob: 7a9db499a38af499f856e7b5d2c6d74fef0c723a (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
39
#include <stdio.h>
#include <raylib.h>
#include <string.h>
#include "game.h"
#include "entity.h"

extern struct game game;

Rectangle get_entity_collider_world(const struct entity* entity) {
  return (Rectangle) {
    .x = entity->collider.x + entity->position.x,
    .y = entity->collider.y + entity->position.y,
    .width = entity->collider.width,
    .height = entity->collider.height
  };
}

void entity_handle_collision
(
 struct entity*,
 struct entity*,
 enum direction
 ) {
}

void draw_entity(const struct entity* entity) {

}

void add_entity(const struct entity* e) {
  for (int i = 0; i < MAX_ENTITY_COUNT; i++) {
    struct entity* current = &game.entities[i];
    if (entity_active(current))
      continue;

    memcpy(current, e, sizeof(struct entity));
    return;
  }
}