diff options
author | chai <chaifix@163.com> | 2021-11-04 12:48:01 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-04 12:48:01 +0800 |
commit | 94a9a28de16badb75e66a60efca3b01d31cc0fc6 (patch) | |
tree | a37e09236da2b7cda11a451d6fed4fe37afb065c /Runtime/Scripting/GUI | |
parent | b215d811a1981e20f35bb31df4e6cd2a74146193 (diff) |
* text anchor
Diffstat (limited to 'Runtime/Scripting/GUI')
-rw-r--r-- | Runtime/Scripting/GUI/Font.bind.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Runtime/Scripting/GUI/Font.bind.cpp b/Runtime/Scripting/GUI/Font.bind.cpp index 7172027..e749303 100644 --- a/Runtime/Scripting/GUI/Font.bind.cpp +++ b/Runtime/Scripting/GUI/Font.bind.cpp @@ -88,15 +88,17 @@ LUA_BIND_IMPL_METHOD(Font, _GetCharacter) return 1;
}
-// font:GetCharacter(str, size, encoding)
+// font:GetCharacter(str, size, wordwrap, preferredWidth, encoding)
LUA_BIND_IMPL_METHOD(Font, _GetCharacters) {
LUA_BIND_PREPARE(L, Font);
- LUA_BIND_CHECK(L, "USN*");
+ //LUA_BIND_CHECK(L, "US");
char* buf = (char*)state.GetValue<const char*>(2, "");
int size = state.GetValue<int>(3, 12);
- int encoding = state.GetValue<int>(4, EEncoding::Encoding_UTF8);
+ bool wordwrap = state.GetValue<bool>(4, false);
+ float preferred = state.GetValue<float>(5, 0);
+ int encoding = state.GetValue<int>(6, EEncoding::Encoding_UTF8);
s_Codepoints->clear();
if (encoding == EEncoding::Encoding_UTF8)
@@ -134,7 +136,7 @@ LUA_BIND_IMPL_METHOD(Font, _GetCharacters) WipeGLError();
- UITextMesh* tm = new UITextMesh(str, self, size, ETextAnchor::TextAnchor_MiddleLeft, ETextAlignment::TextAlignment_Left);
+ UITextMesh* tm = new UITextMesh(str, self, size, size + 3, TextAnchor_MiddleLeft, ETextAlignment::TextAlignment_Left, wordwrap, preferred);
tm->Draw();
return 0;
|