Aether
SDL2 based UI Framework for NX
TextBlock.hpp
1 #ifndef AETHER_TEXTBLOCK_HPP
2 #define AETHER_TEXTBLOCK_HPP
3 
4 #include "Aether/base/BaseText.hpp"
5 
6 namespace Aether {
10  class TextBlock : public BaseText {
11  private:
13  std::atomic<unsigned int> wrapWidth_;
14 
18  Drawable * renderDrawable();
19 
20  public:
31  TextBlock(const int x, const int y, const std::string & str, const unsigned int size, const unsigned int wrap, const Render type = Render::Sync);
32 
43  static std::pair<int, int> getDimensions(const std::string & str, const unsigned int size, const unsigned int width);
44 
50  unsigned int wrapWidth();
51 
57  void setWrapWidth(const unsigned int wrap);
58  };
59 };
60 
61 #endif
TextBlock(const int x, const int y, const std::string &str, const unsigned int size, const unsigned int wrap, const Render type=Render::Sync)
Constructs a new TextBlock element.
void setWrapWidth(const unsigned int wrap)
Set the new max line width.
static std::pair< int, int > getDimensions(const std::string &str, const unsigned int size, const unsigned int width)
Returns the dimensions of the given string if it were to be rendered, without performing any slow ren...
Stores either a surface or texture which can be drawn on screen by providing a renderer to render()...
Definition: Drawable.hpp:22
int x()
Returns x-coordinate of element.
BaseText is an abstract class storing relevant information to render a text element.
Definition: BaseText.hpp:12
Base namespace for all Aether related classes and functions.
unsigned int wrapWidth()
Returns the maximum width allowed for a line.
Element for rendering a multi-line block of text.
Definition: TextBlock.hpp:10
Render
Supported "on create" texture rendering options.
Definition: Texture.hpp:11
int y()
Returns y-coordinate of element.