#pragma once #include #include #include #include #include #include "core/vfs.h" namespace playground { // Image cache and ordered 2D draw calls in the display's logical coordinate space. class Draw { public: Draw(SDL_Renderer* renderer, const Vfs& assets); ~Draw(); Draw(const Draw&) = delete; Draw& operator=(const Draw&) = delete; SDL_Texture* load(const std::string& path); bool image(const std::string& path, const SDL_FRect& destination); bool image(const std::string& path, const SDL_FRect* source, const SDL_FRect& destination); bool text(const std::string& utf8, float x, float y, SDL_Color color, int pointSize = 16, float alignWidth = 0, bool center = false, const std::string& fontName = "", int outlineSize = 0, SDL_Color outlineColor = {0, 0, 0, 255}); void clear(); private: SDL_Renderer* renderer_; const Vfs& assets_; std::unordered_map textures_; std::unordered_map textTextures_; std::unordered_map vectorFonts_; std::unordered_map sizedFonts_; std::unordered_set warnedVectorFonts_; bool ttfReady_ = false; }; } // namespace playground