#pragma once #include struct Game; typedef struct Entity Entity; struct Entity { unsigned long uuid; void (*update_begin)(Entity *this, struct Game *g); void (*update)(Entity *this, struct Game *g); void (*update_end)(Entity *this, struct Game *g); void (*draw_begin)(Entity *this, struct Game *g); void (*draw)(Entity *this, struct Game *g); void (*draw_end)(Entity *this, struct Game *g); unsigned int type; const char *name; int pos[2]; double vel[2]; double rem[2]; int width; int height; bool ignore_solids; union { struct { int life; } part; }; }; unsigned int entity_type(const char *typename); unsigned int entity_type_parent(unsigned int type); bool entity_is_type(unsigned int type, unsigned int search); bool entity_collide(Entity *this, int ox, int oy); bool entity_meet(Entity *this, Entity *other); Entity *entity_place_meeting(Entity *this, struct Game *g, unsigned int type); void entity_move(Entity *this, struct Game *g); Entity *entity_init(Entity *this, unsigned int type, const char *name, int x, int y, int w, int h);