From 94a9a28de16badb75e66a60efca3b01d31cc0fc6 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 4 Nov 2021 12:48:01 +0800 Subject: * text anchor --- Runtime/Scripting/GUI/Font.bind.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Runtime/Scripting/GUI') 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(2, ""); int size = state.GetValue(3, 12); - int encoding = state.GetValue(4, EEncoding::Encoding_UTF8); + bool wordwrap = state.GetValue(4, false); + float preferred = state.GetValue(5, 0); + int encoding = state.GetValue(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; -- cgit v1.1-26-g67d0