#ifndef ENTITY_H_ #define ENTITY_H_ #include #include #include enum entity_type { Player_Entity }; enum direction { Direction_Up, Direction_Down, Direction_Left, Direction_Right }; #define ENTITY_ACTIVE 1 #define ENTITY_COLLISION_ACTIVE (1 << 1) struct entity { int entity_id; enum entity_type type; uint32_t flags; Vector2 position; //The position of the entity(roughly the center) 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