diff options
| author | BoredGuy <osome3717@gmail.com> | 2026-03-16 17:47:57 +0300 |
|---|---|---|
| committer | BoredGuy <osome3717@gmail.com> | 2026-03-16 17:47:57 +0300 |
| commit | ac02199694ffef81a00a8ea47420e88ef0a35f67 (patch) | |
| tree | ab8be37dd6960954d7baa54bb1273980063c66ba /src/entity.h | |
| parent | 2c2be83a370318ca69824538ed3e61784295a772 (diff) | |
More work on systems
- Will be done soon (I think)
- Added first entity
Diffstat (limited to 'src/entity.h')
| -rw-r--r-- | src/entity.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/entity.h b/src/entity.h index 94eb00f..ac179c1 100644 --- a/src/entity.h +++ b/src/entity.h @@ -9,6 +9,7 @@ #define ENTITY_ACTIVE 1 #define ENTITY_COLLISION_ACTIVE (1 << 1) #define ENTITY_VISIBLE (1 << 2) +#define ENTITY_ANIMATED (1 << 3) enum entity_type { Player_Entity @@ -38,6 +39,9 @@ struct animation { float current_frame_time; }; +void update_animation(struct animation* animation, float dt); +Rectangle get_current_srcrect(const struct animation* animation); + struct entity { int entity_id; enum entity_type type; @@ -48,6 +52,7 @@ struct entity { Rectangle collider; Texture texture; + Rectangle sprite_source_rect; //Used if entity doesn't have sprite animations Rectangle sprite_dest_rect; //Relative to the position of entity (roughly the center) struct animation animations[ENTITY_MAX_ANIMATIONS]; int current_animation; @@ -69,7 +74,7 @@ void entity_handle_collision void add_entity(const struct entity* e); static inline bool entity_active(const struct entity* e) { - return e->flags & ENTITY_ACTIVE; + return (e->flags & ENTITY_ACTIVE) != 0; } static inline bool same_entity(const struct entity* a, const struct entity* b) { @@ -77,7 +82,7 @@ static inline bool same_entity(const struct entity* a, const struct entity* b) { } static inline bool entity_visible(const struct entity* e) { - return e->flags & ENTITY_VISIBLE; + return (e->flags & ENTITY_VISIBLE) != 0; } #endif |
