entity.h (628B)
1 #pragma once 2 3 typedef struct Entity entity_t; 4 5 #include "enemy.h" 6 #include "gate.h" 7 #include "game.h" 8 #include "door.h" 9 #include "boss.h" 10 11 typedef enum { 12 ENTITY_ENEMY, 13 ENTITY_GATE, 14 ENTITY_DOOR, 15 ENTITY_BOSS, 16 } entity_e; 17 18 struct Entity { 19 entity_e type; 20 union { 21 enemy_t *enemy; 22 gate_t *gate; 23 door_t *door; 24 boss_t *boss; 25 }; 26 bool is_bad; 27 }; 28 29 entity_t *entity_create(entity_e type); 30 void entity_update(entity_t *entity, game_t *game); 31 void entity_draw(entity_t *entity, game_t *game); 32 void entity_detach(entity_t *entity); 33 void entity_free(entity_t *entity); 34 35 rect_t entity_get_rect(entity_t *entity);