entity.h (468B)
1 #pragma once 2 3 typedef struct Entity entity_t; 4 5 #include "enemy.h" 6 #include "gate.h" 7 #include "game.h" 8 9 typedef enum { 10 ENTITY_ENEMY, 11 ENTITY_GATE, 12 } entity_e; 13 14 struct Entity { 15 entity_e type; 16 union { 17 enemy_t *enemy; 18 gate_t *gate; 19 }; 20 }; 21 22 entity_t *entity_create(entity_e type); 23 void entity_update(entity_t *entity, game_t *game); 24 void entity_draw(entity_t *entity, game_t *game); 25 void entity_detach(entity_t *entity); 26 void entity_free(entity_t *entity);