diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/constants.h | 6 | ||||
-rw-r--r-- | include/game.h | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/include/constants.h b/include/constants.h index 2f9625a..870c7fb 100644 --- a/include/constants.h +++ b/include/constants.h @@ -4,4 +4,8 @@ #define WINDOW_HEIGHT 720 #define MAX_ENTITY_COUNT 2048 -#define MAX_AREA_COUNT 4
\ No newline at end of file +#define MAX_AREA_COUNT 4 + +#define MAX_SPRITE_COUNT 4 //Maximum number of sprites per entity + +#define NO_OFFSET 0 diff --git a/include/game.h b/include/game.h index fbfe2e1..e54afd3 100644 --- a/include/game.h +++ b/include/game.h @@ -21,6 +21,12 @@ typedef enum DrawLayer { Foreground_Layer = 1 } DrawLayer; +typedef struct Sprite { + Texture2D texture; + DrawLayer layer; + Rectangle destRect; //Destination rectangle relative to player position +} Sprite; + typedef struct Entity { int id; EntityType type; @@ -36,10 +42,8 @@ typedef struct Entity { int numHurtBoxes; Rectangle hurtBoxes[MAX_AREA_COUNT]; - //Graphics Information - Texture2D texture; - DrawLayer drawLayer; - Rectangle destRect; //Relative to the players position + Sprite sprites[MAX_SPRITE_COUNT]; + int numSprites; #ifdef BEATEMUP_DEBUG //Debug information @@ -73,6 +77,13 @@ static inline bool SameEntity(const Entity* a, const Entity* b) { return a->id == b->id; } +static inline void AddSpriteToEntity(Entity* e, Sprite s) { + if (e->numSprites < MAX_SPRITE_COUNT) { + e->sprites[e->numSprites++] = s; + } +} + + #ifdef BEATEMUP_DEBUG void DebugHighlights(const Entity* e); #endif |