Files
Text-Adventure/ui/Text.h
T
2026-09-27 21:57:14 -05:00

36 lines
726 B
C++

#pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL_init.h>
#include <SDL3_ttf/SDL_textengine.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <filesystem>
#include <string>
#include "fileCommon.h"
#include "window.h"
#define WHITE {255, 255, 255, SDL_ALPHA_OPAQUE}
class Text {
private:
std::string buffer;
TTF_Font *loadedFont = nullptr;
SDL_Surface *textRenderingSurface = nullptr;
SDL_Color color;
SDL_Texture *font_texture = nullptr;
/// ToDo: Replace with dynamic settings / loaded font
fs::path fontPath;
public:
SDL_AppResult OpenFont(fs::path fontPath);
bool SetText(std::string text, Window *window);
void Render();
void CloseFont() { TTF_CloseFont(loadedFont); }
};