Allow to set the text alignment for text objects by property (#4648)

This commit is contained in:
D8H
2022-12-12 14:17:16 +01:00
committed by GitHub
parent 471053da11
commit 52278180ab
12 changed files with 224 additions and 25 deletions
+4 -1
View File
@@ -29,7 +29,8 @@ TextObject::TextObject()
underlined(false),
colorR(0),
colorG(0),
colorB(0)
colorB(0),
textAlignment("left")
{
}
@@ -39,6 +40,7 @@ void TextObject::DoUnserializeFrom(gd::Project& project,
const gd::SerializerElement& element) {
SetString(element.GetChild("string", 0, "String").GetValue().GetString());
SetFontName(element.GetChild("font", 0, "Font").GetValue().GetString());
SetTextAlignment(element.GetChild("textAlignment").GetValue().GetString());
SetCharacterSize(element.GetChild("characterSize", 0, "CharacterSize")
.GetValue()
.GetInt());
@@ -56,6 +58,7 @@ void TextObject::DoUnserializeFrom(gd::Project& project,
void TextObject::DoSerializeTo(gd::SerializerElement& element) const {
element.AddChild("string").SetValue(GetString());
element.AddChild("font").SetValue(GetFontName());
element.AddChild("textAlignment").SetValue(GetTextAlignment());
element.AddChild("characterSize").SetValue(GetCharacterSize());
element.AddChild("color")
.SetAttribute("r", (int)GetColorR())