multiline labels

This commit is contained in:
MihailRis 2024-02-25 21:03:21 +03:00
parent fcc5d11814
commit d189bdc107
7 changed files with 239 additions and 95 deletions

View file

@ -9,25 +9,27 @@
class Texture;
class Batch2D;
const uint STYLE_NONE = 0;
const uint STYLE_SHADOW = 1;
const uint STYLE_OUTLINE = 2;
enum class FontStyle {
none,
shadow,
outline
};
class Font {
int lineHeight;
int lineHeight;
int yoffset;
public:
std::vector<std::unique_ptr<Texture>> pages;
Font(std::vector<std::unique_ptr<Texture>> pages, int lineHeight, int yoffset);
~Font();
std::vector<std::unique_ptr<Texture>> pages;
Font(std::vector<std::unique_ptr<Texture>> pages, int lineHeight, int yoffset);
~Font();
int getLineHeight() const;
int getLineHeight() const;
int getYOffset() const;
int calcWidth(std::wstring text, size_t length=-1);
// int getGlyphWidth(char c);
bool isPrintableChar(int c);
void draw(Batch2D* batch, std::wstring text, int x, int y);
void draw(Batch2D* batch, std::wstring text, int x, int y, int style);
int calcWidth(std::wstring text, size_t length=-1);
bool isPrintableChar(uint codepoint) const;
void draw(Batch2D* batch, std::wstring text, int x, int y);
void draw(Batch2D* batch, std::wstring text, int x, int y, FontStyle style);
void draw(Batch2D* batch, std::wstring_view text, int x, int y, FontStyle style);
};
#endif /* GRAPHICS_FONT_H_ */