summaryrefslogtreecommitdiff
path: root/Editor/EditorMain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Editor/EditorMain.cpp')
-rw-r--r--Editor/EditorMain.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp
index 69c1c1a..e31da28 100644
--- a/Editor/EditorMain.cpp
+++ b/Editor/EditorMain.cpp
@@ -9,6 +9,8 @@
#include "Editor/Win/Win.h"
#include "Runtime/Threading/Thread.h"
+#include "Runtime/GUI/TextGenerator.h"
+
using namespace LuaBind;
void ErrorHandle(cc8* msg)
@@ -16,6 +18,27 @@ void ErrorHandle(cc8* msg)
log_error(std::string("[Lua] ") + msg);
}
+void TestFont()
+{
+ TextGeneratingSettings setting;
+ setting.margin = 5;
+ setting.padding = 3;
+ setting.atlasSize = Internal::Vector2(256, 256);
+ TextGenerator::Instance()->Setup(setting);
+ TextGenerator::Instance()->RenderCharacter(L'好', 14);
+ TextGenerator::Instance()->RenderCharacter(L'大', 14);
+ TextGenerator::Instance()->RenderCharacter(L'家', 14);
+ TextGenerator::Instance()->RenderCharacter(L'晚', 14);
+ TextGenerator::Instance()->RenderCharacter(L'上', 14);
+ TextGenerator::Instance()->RenderCharacter(L'快', 14);
+}
+
+int BeforeMainLoop(lua_State* L)
+{
+ TestFont();
+ return 0;
+}
+
void InitLuaState(LuaBind::VM& vm)
{
vm.Setup();
@@ -35,6 +58,9 @@ void InitLuaState(LuaBind::VM& vm)
Win::SetDllSearchDirectory(workingDir);
LuaBind::State state = vm.GetMainState();
+ state.PushGlobalNamespace();
+ state.RegisterMethod("BeforeMainLoop", BeforeMainLoop);
+
state.DoFile("./boot.lua");
}
@@ -50,4 +76,4 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
InitLuaState(vm);
return 0;
-} \ No newline at end of file
+}