43 static constexpr const char*
TypeName =
"Label";
57 color = {255, 0, 255, 255};
71 std::string
text =
"Label";
171 Label(
const InitStruct& init);
172 Label(
const sol::table& config);
176 static std::unique_ptr<IDisplayObject>
CreateFromLua(
const sol::table& config) {
177 return std::unique_ptr<IDisplayObject>(
new Label(config));
181 return std::unique_ptr<IDisplayObject>(
new Label(labelInit));
185 virtual ~Label()
override;
188 virtual bool onInit()
override;
189 virtual void onQuit()
override;
190 virtual void onUpdate(
float fElapsedTime)
override;
195 void setText(std::string p_text);
302 void _maxSize(
float& width,
float& height);
312 bool rebuildTexture_(
int width,
int height, SDL_PixelFormat fmt = SDL_PIXELFORMAT_RGBA8888 );
Definition SDOM_AssetHandle.hpp:13
T * as() const
Definition SDOM_AssetHandle.hpp:38
Definition SDOM_Event.hpp:55
Definition SDOM_IDisplayObject.hpp:153
IDisplayObject & setDirty()
Definition SDOM_IDisplayObject.hpp:237
Definition SDOM_IFontObject.hpp:170
FontType
Definition SDOM_IFontObject.hpp:177
virtual int getGlyphHeight(Uint32 ch) const =0
Definition SDOM_Label.hpp:38
const std::vector< LabelToken > & getTokenList() const
Definition SDOM_Label.hpp:293
void setText(std::string p_text)
Definition SDOM_Label.cpp:514
std::vector< LabelToken > tokenList
Definition SDOM_Label.hpp:245
int current_width
Definition SDOM_Label.hpp:307
virtual void onRender() override
Definition SDOM_Label.cpp:443
virtual bool onInit() override
Definition SDOM_Label.cpp:250
int parent_height_
Definition SDOM_Label.hpp:310
static std::unique_ptr< IDisplayObject > CreateFromLua(const sol::table &config)
Definition SDOM_Label.hpp:176
std::unordered_map< LabelAlign, AlignQueue > alignXRef_
Definition SDOM_Label.hpp:267
void _buildPhraseAlignLists()
Definition SDOM_Label.cpp:1412
void setDefaultStyle(const FontStyle &style)
Definition SDOM_Label.hpp:213
std::string getText() const
Definition SDOM_Label.hpp:196
int fontHeight_
Definition SDOM_Label.hpp:230
AssetHandle fontAsset
Definition SDOM_Label.hpp:232
static const std::unordered_map< LabelAlign, std::string > labelAlignToString_
Definition SDOM_Label.hpp:110
RenderPass
Definition SDOM_Label.hpp:167
FontStyle & getDefaultStyle()
Definition SDOM_Label.hpp:212
int current_height
Definition SDOM_Label.hpp:308
int getGlyphHeight() const
Definition SDOM_Label.hpp:199
virtual void onUpdate(float fElapsedTime) override
Definition SDOM_Label.cpp:371
TokenType
Definition SDOM_Label.hpp:148
int tokenizeText()
Definition SDOM_Label.cpp:530
std::string resourceName_
Definition SDOM_Label.hpp:234
void _maxSize(float &width, float &height)
Definition SDOM_Label.cpp:1297
static std::unique_ptr< IDisplayObject > CreateFromInitStruct(const Label::InitStruct &baseInit)
Definition SDOM_Label.hpp:179
friend Factory
Definition SDOM_Label.hpp:223
virtual ~Label() override
Definition SDOM_Label.cpp:244
IFontObject::FontType getFontType() const
Definition SDOM_Label.hpp:198
const std::map< AlignQueue, std::vector< PhraseToken > > & getPhraseAlignLists() const
Definition SDOM_Label.hpp:296
bool rebuildTexture_(int width, int height, SDL_PixelFormat fmt=SDL_PIXELFORMAT_RGBA8888)
Definition SDOM_Label.cpp:1663
void _debugToken(const LabelToken &token)
Definition SDOM_Label.cpp:1264
std::string lastTokenizedText_
Definition SDOM_Label.hpp:227
int parent_width_
Definition SDOM_Label.hpp:309
AssetHandle getFont() const
Definition SDOM_Label.hpp:197
FontStyle defaultStyle_
Definition SDOM_Label.hpp:233
virtual void _registerLuaBindings(const std::string &typeName, sol::state_view lua)
Definition SDOM_Label.cpp:1713
IFontObject::FontType fontType_
Definition SDOM_Label.hpp:231
bool userFontWidthSpecified_
Definition SDOM_Label.hpp:239
static const std::unordered_map< std::string, LabelAlign > stringToLabelAlign_
Definition SDOM_Label.hpp:129
virtual void onQuit() override
Definition SDOM_Label.cpp:351
bool userFontHeightSpecified_
Definition SDOM_Label.hpp:240
SDL_PixelFormat current_pixel_format
Definition SDOM_Label.hpp:306
std::map< AlignQueue, std::vector< LabelToken > > tokenAlignLists_
Definition SDOM_Label.hpp:286
int fontWidth_
Definition SDOM_Label.hpp:229
friend Core
Definition SDOM_Label.hpp:224
const std::string & getLastTokenizedText() const
Definition SDOM_Label.hpp:294
virtual bool onUnitTest() override
Runs unit tests for this object.
Definition SDOM_Label.cpp:509
AlignQueue
Definition SDOM_Label.hpp:249
virtual void onEvent(const Event &event) override
Definition SDOM_Label.cpp:437
SDL_Texture * cachedTexture_
Definition SDOM_Label.hpp:242
static constexpr const char * TypeName
Definition SDOM_Label.hpp:43
bool needsTextureRebuild_(int width, int height, SDL_PixelFormat fmt) const
Definition SDOM_Label.cpp:1655
bool isPunctuation(char c)
Definition SDOM_Label.cpp:525
void renderLabel()
Definition SDOM_Label.cpp:969
std::string text_
Definition SDOM_Label.hpp:226
void renderLabelPass(RenderPass pass)
Definition SDOM_Label.cpp:976
std::map< AlignQueue, std::vector< PhraseToken > > phraseAlignLists_
Definition SDOM_Label.hpp:289
const std::map< AlignQueue, std::vector< LabelToken > > & getTokenAlignLists() const
Definition SDOM_Label.hpp:295
void _buildTokenAlignLists()
Definition SDOM_Label.cpp:1157
int fontSize_
Definition SDOM_Label.hpp:228
Contains all core classes and utilities for the SDOM library.
Definition lua_BindHelpers.hpp:7
LabelAlign
Definition SDOM_IFontObject.hpp:14
@ TOP_LEFT
Top-left corner of the parent.
Definition SDOM_IFontObject.hpp:35
Definition SDOM_IDisplayObject.hpp:187
std::string type
Definition SDOM_IDisplayObject.hpp:189
AnchorPoint anchorLeft
Definition SDOM_IDisplayObject.hpp:203
float height
Definition SDOM_IDisplayObject.hpp:193
bool tabEnabled
Definition SDOM_IDisplayObject.hpp:212
std::string name
Definition SDOM_IDisplayObject.hpp:188
AnchorPoint anchorBottom
Definition SDOM_IDisplayObject.hpp:204
AnchorPoint anchorTop
Definition SDOM_IDisplayObject.hpp:202
float width
Definition SDOM_IDisplayObject.hpp:192
int z_order
Definition SDOM_IDisplayObject.hpp:206
SDL_Color color
Definition SDOM_IDisplayObject.hpp:194
float x
Definition SDOM_IDisplayObject.hpp:190
int priority
Definition SDOM_IDisplayObject.hpp:207
float y
Definition SDOM_IDisplayObject.hpp:191
int tabPriority
Definition SDOM_IDisplayObject.hpp:211
bool isClickable
Definition SDOM_IDisplayObject.hpp:208
bool isEnabled
Definition SDOM_IDisplayObject.hpp:209
AnchorPoint anchorRight
Definition SDOM_IDisplayObject.hpp:205
bool isHidden
Definition SDOM_IDisplayObject.hpp:210
Definition SDOM_Label.hpp:47
int dropshadowOffsetY
Definition SDOM_Label.hpp:102
int padding_vert
Definition SDOM_Label.hpp:100
std::string resourceName
Definition SDOM_Label.hpp:72
int borderThickness
Definition SDOM_Label.hpp:97
bool underline
Definition SDOM_Label.hpp:87
LabelAlign alignment
Definition SDOM_Label.hpp:77
int dropshadowOffsetX
Definition SDOM_Label.hpp:101
bool dropshadow
Definition SDOM_Label.hpp:92
IFontObject::FontType fontType
Definition SDOM_Label.hpp:73
int maxHeight
Definition SDOM_Label.hpp:96
bool auto_resize
Definition SDOM_Label.hpp:94
InitStruct()
Definition SDOM_Label.hpp:48
bool strikethrough
Definition SDOM_Label.hpp:88
bool wordwrap
Definition SDOM_Label.hpp:93
bool border
Definition SDOM_Label.hpp:89
bool outline
Definition SDOM_Label.hpp:91
int fontWidth
Definition SDOM_Label.hpp:75
int fontSize
Definition SDOM_Label.hpp:74
int fontHeight
Definition SDOM_Label.hpp:76
int padding_horiz
Definition SDOM_Label.hpp:99
int outlineThickness
Definition SDOM_Label.hpp:98
bool italic
Definition SDOM_Label.hpp:86
bool background
Definition SDOM_Label.hpp:90
std::string text
Definition SDOM_Label.hpp:71
bool bold
Definition SDOM_Label.hpp:85
int maxWidth
Definition SDOM_Label.hpp:95
Definition SDOM_Label.hpp:150
FontStyle style
Definition SDOM_Label.hpp:153
std::string text
Definition SDOM_Label.hpp:152
TokenType type
Definition SDOM_Label.hpp:151
Definition SDOM_Label.hpp:157
float height
Definition SDOM_Label.hpp:164
float startX
Definition SDOM_Label.hpp:161
std::string text
Definition SDOM_Label.hpp:158
int lineIndex
Definition SDOM_Label.hpp:160
float lineY
Definition SDOM_Label.hpp:162
FontStyle style
Definition SDOM_Label.hpp:159
float width
Definition SDOM_Label.hpp:163