diff options
Diffstat (limited to 'src/entity.h')
-rw-r--r-- | src/entity.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/entity.h b/src/entity.h new file mode 100644 index 0000000..01230d5 --- /dev/null +++ b/src/entity.h @@ -0,0 +1,25 @@ +#pragma once +#include <stdbool.h> + +struct Game; + +typedef struct Entity Entity; +struct Entity { + unsigned long uuid; + void (*update)(Entity *this, struct Game *g); + void (*draw)(Entity *this, struct Game *g); + unsigned int type; + int pos[2]; + double vel[2]; + double rem[2]; + int width; + int height; + bool ignore_solids; +}; + +unsigned int entity_type(const char *typename); +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, int x, int y); |