Something went wrong. Try again.
art software for the rest of us
drawing paint image sdl art
Something went wrong. Try again.
C
123456789101112131415161718192021222324252627282930313233#pragma once#include "../Texture.h"#include <SDL3_ttf/SDL_ttf.h>#include <string>#include "../UserInterface/Engine/Geometry.h"
class Text { double x, y; std::string content; Texture* texture = nullptr; static TTF_Font* font; static TTF_Font* iconFont; static float fontScale; // ui scale the fonts were last sized at static float iconFontScale; float textureScale = 1.0f; // ui scale this texture was rasterized at TTF_Font* overriddenFont = nullptr; double r = 1, g = 1, b = 1, a = 1;
void createTexture(); static void EnsureFonts(); // opens/re-sizes the shared fonts for the current ui scalepublic: Text(double x, double y, std::string content, TTF_Font* font = nullptr); void SetText(const std::string& content); void SetPosition(double x, double y); void SetColor(double r, double g, double b, double a); void Render(); ~Text();
static void Init(); static TTF_Font* GetIconFont(); // shared material icons font, sized for the current ui scale static UI::Size Measure(std::string content);};