Add SDL2 support

This commit is contained in:
2025-06-07 02:41:14 -05:00
parent 8dc8b9ea86
commit dd4527645e
9 changed files with 188 additions and 4 deletions

View File

@ -0,0 +1,28 @@
#pragma once
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
#include <array>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include <string>
#include <vector>
namespace Tesses::Framework::SDL2
{
class FontCache
{
std::array<SDL_Texture*,96> font_chrs;
int mw,mh,ps;
void Load(SDL_Renderer* renderer,TTF_Font* font,const SDL_Color& color);
public:
FontCache(SDL_Renderer* renderer,TTF_Font* font,const SDL_Color& color);
FontCache(SDL_Renderer* renderer,std::string font,int sz,const SDL_Color& color);
FontCache(SDL_Renderer* renderer,const uint8_t* mem,size_t cnt,int sz,const SDL_Color& color);
FontCache(SDL_Renderer* renderer,const std::vector<uint8_t>& v,int sz,const SDL_Color& color);
SDL_Texture* operator[](char c);
int MaxWidth();
int MaxHeight();
int PointSize();
~FontCache();
};
}
#endif