Simple GUI Library
text.h
Go to the documentation of this file.
1/**
2 * @author Nikita Mochalov (github.com/tralf-strues)
3 * @file text.h
4 * @date 2021-11-06
5 *
6 * @copyright Copyright (c) 2021
7 */
8
9#pragma once
10
11#include "sml/graphics_wrapper/text.h"
12#include "shape.h"
13
14namespace Sgl
15{
16 class Text : public Shape
17 {
18 public:
19 Text(const Sml::Font& font, const char* string, Sml::Color color = Sml::COLOR_BLACK);
20 Text(const char* string, Sml::Color color = Sml::COLOR_BLACK);
21
22 virtual void render(const Sml::Rectangle<int32_t>& targetRegion) override;
23 virtual void prerender() override;
24
25 const Sml::Font& getFont() const;
26 Sml::Color getColor() const;
27 const char* getStr() const;
28 size_t getWidth() const;
29 size_t getHeight() const;
30 size_t getWrapWidth() const;
31
32 void setFont(const Sml::Font& font);
33 void setColor(Sml::Color color);
34 void setString(const char* str);
35 void setWrapWidth(size_t wrapWidth);
36
37 virtual int32_t computePrefWidth(int32_t height = -1) const override final;
38 virtual int32_t computePrefHeight(int32_t width = -1) const override final;
39
40 private:
41 Sml::Text m_Text;
42 };
43}
Definition: text.h:17