Updated the list rendering function to just blindly take textures from the cache and relying on a new function to handle generating new textures if needed.

This commit is contained in:
2022-11-02 19:15:57 -05:00
parent 3dfe60fcc6
commit 08643b8fc5
5 changed files with 55 additions and 45 deletions
+3 -2
View File
@@ -10,14 +10,15 @@
typedef struct {
unsigned int Capacity;
unsigned int Size;
unsigned int MaxStringLength;
char** Strings;
SDL_Rect MaxTestSize;
SDL_FRect BoundingBox;
TextureFontCache* TextureCache;
} List;
List* CreateList(SDL_FRect boundingBox);
void AddStringToList(char* text, List* list);
void RenderList(SDL_Renderer* renderer, SDL_Point motion, TTF_Font* font, unsigned short fontSize, List* list);
void RenderList(SDL_Renderer* renderer, SDL_Point motion, List* list);
void ListFontSizeHasChanged(SDL_Renderer* renderer, TTF_Font* font, List* list);
#endif
+2 -2
View File
@@ -17,8 +17,8 @@ typedef struct {
} TextureFontCache;
TextureFontCache* CreateTextureFontCache();
TextureDetails* AddTextureToCache(SDL_Texture* texture, unsigned short fontSize, SDL_Rect textSize, TextureFontCache* cache);
void UpdateTextureDetails(SDL_Texture* texture, unsigned short fontSize, SDL_Rect textSize, int index, TextureFontCache* cache);
TextureDetails* AddTextureToCache(SDL_Texture* texture, SDL_Rect textSize, TextureFontCache* cache);
void UpdateTextureDetails(SDL_Texture* texture, SDL_Rect textSize, int index, TextureFontCache* cache);
TextureDetails* GetTextureFromCache(TextureFontCache* cache, unsigned int index);
void FreeTextureDetails(TextureDetails* details);