diff options
| author | BoredGuy <osome3717@gmail.com> | 2026-03-15 17:08:36 +0300 |
|---|---|---|
| committer | BoredGuy <osome3717@gmail.com> | 2026-03-15 17:08:36 +0300 |
| commit | 9e24aa042e9fb9de34f7b445778518fcb67e24aa (patch) | |
| tree | eb71468111da570dad7e1117e04a25aeba08e29c /src/entity.h | |
| parent | 0ed3bb4569ded185237c6d530285382e6c2b6200 (diff) | |
Some Updates
Diffstat (limited to 'src/entity.h')
| -rw-r--r-- | src/entity.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/entity.h b/src/entity.h index cbde27a..2ed443f 100644 --- a/src/entity.h +++ b/src/entity.h @@ -2,24 +2,52 @@ #define ENTITY_H_ #include <raylib.h> -#define <stdint.h> +#include <stdbool.h> +#include <stdint.h> enum entity_type { Player_Entity }; +enum direction { + Direction_Up, + Direction_Down, + Direction_Left, + Direction_Right +}; + #define ENTITY_ACTIVE 1 -#define ENTITY_PHYSICS_ENABLED (1 << 1) +#define ENTITY_COLLISION_ACTIVE (1 << 1) struct entity { + int entity_id; enum entity_type type; - uint32_t entity_flags flags + uint32_t flags; Vector2 position; //The position of the entity(roughly the center) - Rectangle body; + Vector2 velocity; + Rectangle collider; }; void update_entity(struct entity* entity, float dt); void draw_entity(const struct entity* entity); +Rectangle get_entity_collider_world(const struct entity* entity); + +void entity_handle_collision +( + struct entity* self, + struct entity* other, + enum direction collision_direction); + +void add_entity(const struct entity* e); + +static inline bool entity_active(const struct entity* e) { + return e->flags & ENTITY_ACTIVE; +} + +static inline bool same_entity(const struct entity* a, const struct entity* b) { + return a->entity_id == b->entity_id; +} + #endif |
