// Font.h - Font rendering abstraction with simple size cache #pragma once #include #include #include struct SDL_Renderer; class FontAtlas { public: bool init(const std::string& path, int basePt); void shutdown(); void draw(SDL_Renderer* r, float x, float y, const std::string& text, float scale, SDL_Color color); // Measure rendered text size in pixels for a given scale void measure(const std::string& text, float scale, int& outW, int& outH); private: std::string fontPath; int baseSize{24}; std::unordered_map cache; // point size -> font* TTF_Font* getSized(int ptSize); };