From 251be1ac2d808dfd0fca5c0eb37398357ca7bb20 Mon Sep 17 00:00:00 2001 From: BoredGuy Date: Thu, 7 Aug 2025 10:10:18 +0300 Subject: Huge Commit - Added (static)sprites - Removed variable fps (removes wierd camera jitter) Also I'm becoming increasingly more anti-VSync --- include/game.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'include/game.h') 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 -- cgit v1.2.3