summaryrefslogtreecommitdiff
path: root/Editor
diff options
context:
space:
mode:
Diffstat (limited to 'Editor')
-rw-r--r--Editor/EditorMain.cpp20
-rw-r--r--Editor/GUI/GUIWindow.cpp5
-rw-r--r--Editor/GUI/IMGUI/GUIButton.cpp (renamed from Editor/IMGUI/GUIButton.cpp)0
3 files changed, 19 insertions, 6 deletions
diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp
index 182a2c4..95937a7 100644
--- a/Editor/EditorMain.cpp
+++ b/Editor/EditorMain.cpp
@@ -15,24 +15,40 @@ void ErrorHandle(cc8* msg)
log_error(std::string("[Lua] ") + msg);
}
+void OnRegisterFactoryClass(LuaBind::State& state, int cls, std::string clsName, std::string pkgName)
+{
+ // 填充类型的元数据
+ lua_newtable(state);
+ int typeIdx = state.GetTop();
+ state.Push("native");
+ state.SetField(typeIdx, "mode");
+ state.Push(clsName);
+ state.SetField(typeIdx, "name");
+ state.Push(pkgName);
+ state.SetField(typeIdx, "package");
+ lua_setfield(state, cls, "_type");
+}
+
void InitLuaState()
{
LuaBind::VM vm;
vm.Setup();
vm.OpenLibs();
+
+ LuaBind::onRegisterFactoryClass = OnRegisterFactoryClass;
+
if (!SetupGameLabEditorScripting(vm.GetMainThread()))
{
log_error("Can't setup scripting.");
}
- LuaBind::State state = vm.GetMainState();
// https://stackoverflow.com/questions/21495901/loadlibrarya-and-relative-path/21495971
// ll_load装载dll,路径需要设置搜索路径
std::string workingDir = Win::GetCurrentWorkingDirectory();
Win::SetDllSearchDirectory(workingDir);
+ LuaBind::State state = vm.GetMainState();
state.DoFile("./boot.lua", ErrorHandle);
- state.DoFile("./Scripts/EditorApplication.lua", ErrorHandle);
}
#ifdef GAMELAB_DEBUG
diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp
index 107a298..0502b21 100644
--- a/Editor/GUI/GUIWindow.cpp
+++ b/Editor/GUI/GUIWindow.cpp
@@ -45,10 +45,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara
{
log_info("WndProc", "WM_PAINT");
self->SetAsRenderContext();
- glEnable(GL_BLEND);
- glClearColor(1,0,0,1);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glFlush();
+
BeginPaint(self->m_Handle, &ps);
EndPaint(self->m_Handle, &ps);
UpdateWindow(self->m_Handle);
diff --git a/Editor/IMGUI/GUIButton.cpp b/Editor/GUI/IMGUI/GUIButton.cpp
index e69de29..e69de29 100644
--- a/Editor/IMGUI/GUIButton.cpp
+++ b/Editor/GUI/IMGUI/GUIButton.cpp