//
// Created by sasha on 27.11.2025.
//

#ifndef RU_DANSOFT_PUZZLE15_TEXT_H
#define RU_DANSOFT_PUZZLE15_TEXT_H

#include "iwidget.h"
#include "engine/asset_cached/font_cache.h"

#include <string>

enum class TextRenderMode {
    Solid,
    Shaded,
    Blended,
    LCD
};


class Text : public IWidget {
    public:
        Text(IWidget *parent, float x, float y,
             const std::string &fontName = "",
             float ptsize = 16.0f,
             SDL_Color color = {0, 0, 0, 255},
             SDL_Color bgColor = {0, 0, 0, 255},
             TextRenderMode renderMode = TextRenderMode::Blended,
             bool cached = false
        );

        ~Text();

        void setText(const std::string &text,
                     const std::string &fontName,
                     float ptsize = 16.0f,
                     SDL_Color color = {0, 0, 0, 255},
                     SDL_Color bgColor = {0, 0, 0, 255},
                     TextRenderMode renderMode = TextRenderMode::Blended
                    );

        void setText(const std::string &text);

        // установить кэширование
        void setCached(bool value);

        void draw() override;

    private:
        SDL_Texture *texture = nullptr;

        std::string fontName = "";
        float ptsize = 16.0f;
        SDL_Color color = {0, 0, 0, 255};
        SDL_Color bgColor = {0, 0, 0, 255};
        TextRenderMode renderMode = TextRenderMode::Blended;
        bool cached = false;
};



#endif //RU_DANSOFT_PUZZLE15_TEXT_H
