Added a texture cache for fonts. Created a render function for the List, or at least got one started.
This commit is contained in:
+8
-2
@@ -5,13 +5,19 @@
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include <SDL2/SDL_ttf.h>
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../includes/texture_font_cache.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned int Capcity;
|
||||
unsigned int Capacity;
|
||||
unsigned int Size;
|
||||
unsigned int MaxStringLength;
|
||||
char** Strings;
|
||||
SDL_FRect BoundingBox;
|
||||
TextureFontCache* TextureCache;
|
||||
} List;
|
||||
|
||||
List* CreateList(void);
|
||||
List* CreateList(SDL_FRect boundingBox);
|
||||
void AddStringToList(char* text, List* list);
|
||||
void RenderList(SDL_Renderer* renderer, SDL_FPoint motion, TTF_Font* font, unsigned short fontSize, List* list);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef TEXTURE_FONT_CACHE_h
|
||||
#define TEXTURE_FONT_CACHE_h
|
||||
|
||||
#include <SDL2/SDL_rect.h>
|
||||
#include <SDL2/SDL_render.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned short FontSize;
|
||||
SDL_Rect TextSize;
|
||||
SDL_Texture* Texture;
|
||||
} TextureDetails;
|
||||
|
||||
typedef struct {
|
||||
unsigned int Capacity;
|
||||
unsigned int Size;
|
||||
TextureDetails** Textures;
|
||||
} TextureFontCache;
|
||||
|
||||
TextureFontCache* CreateTextureFontCache();
|
||||
TextureDetails* AddTextureToCache(SDL_Texture* texture, unsigned short fontSize, SDL_Rect textSize, TextureFontCache* cache);
|
||||
TextureDetails* GetTextureFromCache(TextureFontCache* cache, unsigned int index);
|
||||
void FreeTextureDetails(TextureDetails* details);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user