26 #include <SDL3_ttf/SDL_ttf.h>
30 typedef SSIZE_T ssize_t;
33 #if !defined(HAS_NOEXCEPT)
34 #if defined(__clang__)
35 #if __has_feature(cxx_noexcept)
38 #elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 || \
39 defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026
51 SdlWidget(SDL_Renderer* renderer,
const SDL_FRect& rect,
bool input);
52 SdlWidget(SDL_Renderer* renderer,
const SDL_FRect& rect, SDL_IOStream* ops);
60 bool fill(SDL_Renderer* renderer, SDL_Color color);
61 bool fill(SDL_Renderer* renderer,
const std::vector<SDL_Color>& colors);
62 bool update_text(SDL_Renderer* renderer,
const std::string& text, SDL_Color fgcolor);
63 bool update_text(SDL_Renderer* renderer,
const std::string& text, SDL_Color fgcolor,
66 [[nodiscard]]
bool wrap()
const;
67 bool set_wrap(
bool wrap =
true,
size_t width = 0);
68 [[nodiscard]]
const SDL_FRect& rect()
const;
70 #define widget_log_error(res, what) SdlWidget::error_ex(res, what, __FILE__, __LINE__, __func__)
71 static bool error_ex(Uint32 res,
const char* what,
const char* file,
size_t line,
75 SDL_Texture* render_text(SDL_Renderer* renderer,
const std::string& text, SDL_Color fgcolor,
76 SDL_FRect& src, SDL_FRect& dst);
77 SDL_Texture* render_text_wrapped(SDL_Renderer* renderer,
const std::string& text,
78 SDL_Color fgcolor, SDL_FRect& src, SDL_FRect& dst);
80 TTF_Font* _font =
nullptr;
81 SDL_Texture* _image =
nullptr;
85 size_t _text_width = 0;
88 bool clear_window(SDL_Renderer* renderer);