summaryrefslogtreecommitdiff
path: root/Runtime/Scripting
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-02 19:44:01 +0800
committerchai <chaifix@163.com>2021-11-02 19:44:01 +0800
commit72812a7b47f90f9460e54e8149ba9199a7841244 (patch)
tree9ebdb4b65d7cbbc0a3d7c436a9b45d4eff351b62 /Runtime/Scripting
parentb7511abf1a1f302b5c7ebf50faaf65b62d7bb6ed (diff)
! Text mesh done
Diffstat (limited to 'Runtime/Scripting')
-rw-r--r--Runtime/Scripting/GUI/Font.bind.cpp10
-rw-r--r--Runtime/Scripting/Rendering/Shader.bind.cpp4
2 files changed, 13 insertions, 1 deletions
diff --git a/Runtime/Scripting/GUI/Font.bind.cpp b/Runtime/Scripting/GUI/Font.bind.cpp
index 8259a60..733fcf1 100644
--- a/Runtime/Scripting/GUI/Font.bind.cpp
+++ b/Runtime/Scripting/GUI/Font.bind.cpp
@@ -5,6 +5,7 @@
#include "Runtime/Common/DataBuffer.h"
#include "Runtime/GUI/utf8.h"
#include "Runtime/Utilities/StaticInitiator.h"
+#include "Runtime/GUI/TextMesh.h"
static std::vector<character::Codepoint>* s_Codepoints;
@@ -127,6 +128,15 @@ LUA_BIND_IMPL_METHOD(Font, _GetCharacters)
self->RenderCharacters(*s_Codepoints, size);
+ UnicodeString str;
+ str.str = s_Codepoints->data();
+ str.length = s_Codepoints->size();
+
+ WipeGLError();
+
+ TextMesh* tm = new TextMesh(str, self, size, ETextAnchor::TextAnchor_MiddleLeft, ETextAlignment::TextAlignment_Left);
+ tm->Draw();
+
return 0;
}
diff --git a/Runtime/Scripting/Rendering/Shader.bind.cpp b/Runtime/Scripting/Rendering/Shader.bind.cpp
index 482efb9..08c96f9 100644
--- a/Runtime/Scripting/Rendering/Shader.bind.cpp
+++ b/Runtime/Scripting/Rendering/Shader.bind.cpp
@@ -63,7 +63,8 @@ LUA_BIND_IMPL_METHOD(Shader, _New)
if (shader != NULL)
shader->PushUserdata(state);
else
- state.PushNil();
+ state.PushNil();
+
return 1;
}
catch (ShaderCompileExecption e)
@@ -72,6 +73,7 @@ LUA_BIND_IMPL_METHOD(Shader, _New)
state.PushNil();
return 1;
}
+
Assert(false);
return 0;
}