diff options
author | chai <chaifix@163.com> | 2021-10-17 23:05:01 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-17 23:05:01 +0800 |
commit | 7c8c68d79343d04be382334c15a73d079450857c (patch) | |
tree | 9aaacc042f0b7eeb4123c07dcc5f49c14fd8026c | |
parent | 6e73ca6ada8a41692809dae5db89c8db0675ce1e (diff) |
*misc
-rw-r--r-- | Editor/EditorMain.cpp | 24 | ||||
-rw-r--r-- | Editor/GUI/EditorWindows.h | 11 | ||||
-rw-r--r-- | Editor/GUI/GUIWindow.cpp | 14 | ||||
-rw-r--r-- | Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp | 29 | ||||
-rw-r--r-- | Editor/Scripting/EditorGUI/EditorGUI.bind.cpp | 19 | ||||
-rw-r--r-- | Editor/Scripting/EditorScripting.cpp | 17 | ||||
-rw-r--r-- | Editor/Scripting/EditorScripting.h | 3 | ||||
-rw-r--r-- | Editor/Scripts/EditorApplication.lua | 15 | ||||
-rw-r--r-- | Editor/Shaders/BuiltinShaders.cpp | 2 | ||||
-rw-r--r-- | Editor/Shaders/BuiltinShaders.h | 3 | ||||
-rw-r--r-- | Projects/VisualStudio/Editor/Editor.vcxproj | 53 | ||||
-rw-r--r-- | Projects/VisualStudio/Editor/Editor.vcxproj.filters | 170 | ||||
-rw-r--r-- | Projects/VisualStudio/Runtime/Runtime.vcxproj | 53 | ||||
-rw-r--r-- | Projects/VisualStudio/Runtime/Runtime.vcxproj.filters | 112 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Animation/Animation.lua (renamed from DefaultContent/Libraries/Framework/Animation/Animation.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Class.lua (renamed from DefaultContent/Libraries/Framework/Class.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Core/Camera.lua (renamed from DefaultContent/Libraries/Framework/Core/Camera.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Core/Component.lua (renamed from DefaultContent/Libraries/Framework/Core/Component.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Core/Game.lua (renamed from DefaultContent/Libraries/Framework/Core/Game.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua (renamed from DefaultContent/Libraries/Framework/Core/GameObject.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua (renamed from DefaultContent/Libraries/Framework/Core/Sprite.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua (renamed from DefaultContent/Libraries/Framework/Math/Matrix44.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Math/Quaternion.lua (renamed from DefaultContent/Libraries/Framework/Math/Quaternion.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Math/Vector2.lua (renamed from DefaultContent/Libraries/Framework/Math/Vector2.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Math/Vector3.lua (renamed from DefaultContent/Libraries/Framework/Math/Vector3.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Math/Vector4.lua (renamed from DefaultContent/Libraries/Framework/Math/Vector4.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua (renamed from DefaultContent/Libraries/Framework/Utils/EventCenter.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Utils/StateMachine.lua (renamed from DefaultContent/Libraries/Framework/Utils/StateMachine.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/Utils/Util.lua (renamed from DefaultContent/Libraries/Framework/Utils/Util.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Libraries/Framework/init.lua (renamed from DefaultContent/Libraries/Framework/init.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Scripts/Math/Euler.lua (renamed from DefaultContent/Libraries/Math/Euler.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Scripts/Math/Matrix4x4.lua (renamed from DefaultContent/Libraries/Math/Matrix4x4.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Scripts/Math/Quaternion.lua (renamed from DefaultContent/Libraries/Math/Quaternion.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Scripts/Math/Vector2.lua (renamed from DefaultContent/Libraries/Math/Vector2.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Scripts/Math/Vector3.lua (renamed from DefaultContent/Libraries/Math/Vector3.lua) | 0 | ||||
-rw-r--r-- | Resources/DefaultContent/Textures/blank.png (renamed from DefaultContent/Textures/blank.png) | bin | 188 -> 188 bytes | |||
-rw-r--r-- | Resources/DefaultContent/readme.txt | 6 | ||||
-rw-r--r-- | Resources/Scripts/EditorApplication.lua | 11 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBind.h (renamed from Runtime/Scripting/LuaBind.h) | 6 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindCFunctions.cpp (renamed from Runtime/Scripting/LuaBindCFunctions.cpp) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindCFunctions.h (renamed from Runtime/Scripting/LuaBindCFunctions.h) | 12 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindClass.cpp (renamed from Runtime/Scripting/LuaBindClass.cpp) | 6 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindClass.hpp (renamed from Runtime/Scripting/LuaBindClass.hpp) | 132 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindClass.inc (renamed from Runtime/Scripting/LuaBindClass.inc) | 80 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindConfig.h (renamed from Runtime/Scripting/LuaBindConfig.h) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindEnum.cpp (renamed from Runtime/Scripting/LuaBindEnum.cpp) | 6 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindEnum.h (renamed from Runtime/Scripting/LuaBindEnum.h) | 12 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindGlobalState.h (renamed from Runtime/Scripting/LuaBindGlobalState.h) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindInternal.h (renamed from Runtime/Scripting/LuaBindInternal.h) | 6 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindMemberRef.cpp (renamed from Runtime/Scripting/LuaBindMemberRef.cpp) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindMemberRef.h (renamed from Runtime/Scripting/LuaBindMemberRef.h) | 8 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindRef.cpp (renamed from Runtime/Scripting/LuaBindRef.cpp) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindRef.h (renamed from Runtime/Scripting/LuaBindRef.h) | 18 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindRefTable.cpp (renamed from Runtime/Scripting/LuaBindRefTable.cpp) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindRefTable.h (renamed from Runtime/Scripting/LuaBindRefTable.h) | 30 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindState.cpp (renamed from Runtime/Scripting/LuaBindState.cpp) | 13 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindState.h (renamed from Runtime/Scripting/LuaBindState.h) | 80 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindState.inc (renamed from Runtime/Scripting/LuaBindState.inc) | 12 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindUtility.h (renamed from Runtime/Scripting/LuaBindUtility.h) | 14 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindVM.cpp (renamed from Runtime/Scripting/LuaBindVM.cpp) | 10 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindVM.h (renamed from Runtime/Scripting/LuaBindVM.h) | 17 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindWatchDog.cpp (renamed from Runtime/Scripting/LuaBindWatchDog.cpp) | 0 | ||||
-rw-r--r-- | Runtime/LuaBind/LuaBindWatchDog.h (renamed from Runtime/Scripting/LuaBindWatchDog.h) | 6 | ||||
-rw-r--r-- | Runtime/Math/FloatConversion.h | 38 | ||||
-rw-r--r-- | Runtime/Math/Rect.h | 38 | ||||
-rw-r--r-- | Runtime/Math/Vector2.h | 10 | ||||
-rw-r--r-- | Runtime/Runner.cpp | 0 | ||||
-rw-r--r-- | Runtime/Runner.h | 0 | ||||
-rw-r--r-- | Runtime/Scripting/GL.bind.cpp | 9 |
69 files changed, 599 insertions, 506 deletions
diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp index 8fea1df..9745598 100644 --- a/Editor/EditorMain.cpp +++ b/Editor/EditorMain.cpp @@ -1,11 +1,13 @@ #include <windows.h>
#include <vector>
#include "GUI/EditorWindows.h"
-#include "Runtime/Scripting/LuaBind.h"
+#include "Runtime/LuaBind/LuaBind.h"
#include "EditorManager.h"
#include "Runtime/Graphics/OpenGL.h"
#include "Editor/Scripting/EditorScripting.h"
+using namespace LuaBind;
+
static int MainLoop() {
BOOL returnValue; @@ -37,6 +39,20 @@ void OpenLogTags() {
//log_open_tag("WndProc");
//log_open_tag("Menu");
+ log_open_tag("Scripting");
+}
+
+void InitLuaState()
+{
+ LuaBind::VM vm;
+ vm.Setup();
+ vm.OpenLibs();
+ if (!SetupGameLabEditorScripting(vm.GetMainThread()))
+ {
+ log_error("Can't setup scripting.");
+ }
+ LuaBind::State state = vm.GetMainState();
+ state.DoFile("./Scripts/EditorApplication.lua");
}
#ifdef GAMELAB_DEBUG
@@ -48,11 +64,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) OpenLogTags();
WindowUtil::Init();
- if (!SetupGameLabEditorScripting())
- {
- log_error("Can't setup scripting.");
- return 0;
- }
+ InitLuaState();
ContainnerWindow* wnd = new ContainnerWindow();
Vector2f min = Vector2f(100, 100);
diff --git a/Editor/GUI/EditorWindows.h b/Editor/GUI/EditorWindows.h index 8a146e2..42d2623 100644 --- a/Editor/GUI/EditorWindows.h +++ b/Editor/GUI/EditorWindows.h @@ -4,13 +4,15 @@ #include <windows.h> #include <vector> #include "Runtime/Math/Rect.h" -#include "Runtime/Scripting/LuaBind.h" +#include "Runtime/LuaBind/LuaBind.h" #include "Runtime/Utilities/Singleton.h" #include "Editor/Utils/Log.h" #include "Runtime/Graphics/OpenGL.h" #include "Runtime/Utilities/UtilMacros.h" #include "Editor/Utils/HelperFuncs.h" +using namespace LuaBind; + class GUIWindow; class WindowUtil @@ -35,7 +37,8 @@ private: }; // 一个containner window中有多个viewport -class ContainnerWindow +class ContainnerWindow + : public LuaBind::NativeClass<ContainnerWindow> { public: static LRESULT CALLBACK ContainerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -85,6 +88,10 @@ private: POINT m_MinSize; POINT m_MaxSize; + LUA_BIND_DECL_FACTORY(ContainnerWindow); + LUA_BIND_DECL_METHOD(_SetTitle); + LUA_BIND_DECL_METHOD(_DoPaint); + }; // 窗口基类 diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index 1fe88ca..e58b620 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -4,18 +4,18 @@ static bool RedirectMouseWheel(HWND window, WPARAM wParam, LPARAM lParam) { - //// prevent reentrancy + /// prevent reentrancy //static bool s_ReentrancyCheck = false; //if (s_ReentrancyCheck) // return false; - //// 找到对应的子窗口 + /// 找到对应的子窗口 //GUIWindow* view = GetMouseOverWindow(); //if (!view) // return false; - //// 将鼠标滚轮事件派发到子窗口上去 - //// send mouse wheel to view under mouse + /// 将鼠标滚轮事件派发到子窗口上去 + /// send mouse wheel to view under mouse //s_ReentrancyCheck = true; //::SendMessage(view->GetWindowHandle(), WM_MOUSEWHEEL, wParam, lParam); //s_ReentrancyCheck = false; @@ -56,6 +56,8 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_MOUSEWHEEL: // 在这个子窗口滚动 { + log_info("WM_MOUSEWHEEL"); + // quick check if mouse is in our window RECT rc; POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; @@ -68,7 +70,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara return 0; } - Assert(self->m_Handle != hWnd); + //Assert(self->m_Handle != hWnd); //self->ProcessEventMessages(message, wParam, lParam); return 0; } @@ -172,7 +174,7 @@ void GUIWindow::RepaintAll() { } -////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////// void GUIWindow::ProcessEventMessages(UINT message, WPARAM wParam, LPARAM lParam) { diff --git a/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp b/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp index e69de29..f51b6b4 100644 --- a/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp +++ b/Editor/Scripting/EditorGUI/ContainerWindow.bind.cpp @@ -0,0 +1,29 @@ +#include "Editor/GUI/EditorWindows.h" + +LUA_BIND_REGISTRY(ContainnerWindow) +{ + LUA_BIND_REGISTER_METHODS(state, + { "SetTitle", _SetTitle }, + { "DoPaint", _DoPaint } + ); +} + +LUA_BIND_POSTPROCESS(ContainnerWindow) +{ +} + +LUA_BIND_IMPL_METHOD(ContainnerWindow, _SetTitle) +{ + LUA_BIND_PREPARE(L, ContainnerWindow); + + + + return 0; +} + +LUA_BIND_IMPL_METHOD(ContainnerWindow, _DoPaint) +{ + LUA_BIND_PREPARE(L, ContainnerWindow); + self->DoPaint(); + return 0; +}
\ No newline at end of file diff --git a/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp b/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp index 139597f..be97638 100644 --- a/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp +++ b/Editor/Scripting/EditorGUI/EditorGUI.bind.cpp @@ -1,2 +1,21 @@ +#include "Editor/GUI/EditorWindows.h" +// GameLab.Editor.GUI +void luaopen_GameLab_Editor_GUI(lua_State* L) +{ + LUA_BIND_STATE(L); + state.PushGlobalNamespace(); + + state.PushNamespace("GameLab"); + state.PushNamespace("Editor"); + state.PushNamespace("GUI"); + + state.RegisterFactory<ContainnerWindow>(); + + state.PopNamespace();// EditorGUI + state.PopNamespace();// GameLab + state.PopNamespace();// Editor + state.PopNamespace();// Global + +}
\ No newline at end of file diff --git a/Editor/Scripting/EditorScripting.cpp b/Editor/Scripting/EditorScripting.cpp index 7f1d90c..235636a 100644 --- a/Editor/Scripting/EditorScripting.cpp +++ b/Editor/Scripting/EditorScripting.cpp @@ -1,15 +1,22 @@ #include "EditorScripting.h" #include "Editor/Utils/Log.h" -extern void SetupEditorGUI(); -extern void SetupEditorGUILayout(); -extern void SetupEditorIMGUI(); -extern void SetupEditorResource(); +// GameLab.Editor +extern void luaopen_GameLab_Editor_GUI(lua_State* L); // GameLab.Editor.GUI +extern void luaopen_GameLab_Editor_GUILayout(lua_State* L); // GameLab.Editor.GUILayout +extern void luaopen_GameLab_Editor_IMGUI(lua_State* L); // GameLab.Editor.IMGUI +extern void luaopen_GameLab_Editor_Resource(lua_State* L); // GameLab.Editor.Resource -bool SetupGameLabEditorScripting() +// GameLab.Engine + +// GameLab +extern void luaopen_GameLab_Debug(lua_State* L); + +bool SetupGameLabEditorScripting(lua_State* L) { log_info("Scripting", "SetupGameLabEditorScripting()"); + luaopen_GameLab_Editor_GUI(L); return true; } diff --git a/Editor/Scripting/EditorScripting.h b/Editor/Scripting/EditorScripting.h index 8d32a9d..2ed2233 100644 --- a/Editor/Scripting/EditorScripting.h +++ b/Editor/Scripting/EditorScripting.h @@ -1,3 +1,4 @@ #pragma once +#include "Runtime/LuaBind/LuaBind.h" -bool SetupGameLabEditorScripting(); +bool SetupGameLabEditorScripting(lua_State* L); diff --git a/Editor/Scripts/EditorApplication.lua b/Editor/Scripts/EditorApplication.lua deleted file mode 100644 index fb37d69..0000000 --- a/Editor/Scripts/EditorApplication.lua +++ /dev/null @@ -1,15 +0,0 @@ -local Editor = GameLab.Editor -local Engine = GameLab.Engine - -local ViewEditor = {} - -function ViewEditor:OnGUI() - -end - - --- Editor - -local view = Editor.ContainnerWindow.New(ViewEditor) - - diff --git a/Editor/Shaders/BuiltinShaders.cpp b/Editor/Shaders/BuiltinShaders.cpp new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Editor/Shaders/BuiltinShaders.cpp @@ -0,0 +1,2 @@ + + diff --git a/Editor/Shaders/BuiltinShaders.h b/Editor/Shaders/BuiltinShaders.h new file mode 100644 index 0000000..45dcbb0 --- /dev/null +++ b/Editor/Shaders/BuiltinShaders.h @@ -0,0 +1,3 @@ +#pragma once + + diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj b/Projects/VisualStudio/Editor/Editor.vcxproj index 1ae6d0d..14bdfb3 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj +++ b/Projects/VisualStudio/Editor/Editor.vcxproj @@ -161,19 +161,21 @@ <ClCompile Include="..\..\..\Editor\Scripting\EditorGUI\SplitWindow.bind.cpp" /> <ClCompile Include="..\..\..\Editor\Scripting\EditorScripting.cpp" /> <ClCompile Include="..\..\..\Editor\Scripting\IMGUI\GUIButton.bind.cpp" /> + <ClCompile Include="..\..\..\Editor\Shaders\BuiltinShaders.cpp" /> <ClCompile Include="..\..\..\Editor\Utils\HelperFuncs.cpp" /> <ClCompile Include="..\..\..\Editor\Utils\Log.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindClass.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindEnum.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRef.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindState.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindVM.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.cpp" /> <ClCompile Include="..\..\..\Runtime\Math\Vector2.cpp" /> <ClCompile Include="..\..\..\Runtime\Math\Vector3.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindClass.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindEnum.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRef.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRefTable.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindState.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindVM.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.cpp" /> + <ClCompile Include="..\..\..\Runtime\Scripting\GL.bind.cpp" /> <ClCompile Include="..\..\..\Runtime\Utilities\Base64.cpp" /> <ClCompile Include="..\..\..\Runtime\Utilities\Utf8.cpp" /> </ItemGroup> @@ -186,27 +188,28 @@ <ClInclude Include="..\..\..\Editor\GUI\WinUtils.h" /> <ClInclude Include="..\..\..\Editor\Resource\ResourceManager.h" /> <ClInclude Include="..\..\..\Editor\Scripting\EditorScripting.h" /> + <ClInclude Include="..\..\..\Editor\Shaders\BuiltinShaders.h" /> <ClInclude Include="..\..\..\Editor\Utils\HelperFuncs.h" /> <ClInclude Include="..\..\..\Editor\Utils\Log.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBind.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindClass.hpp" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindConfig.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindEnum.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindGlobalState.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindInternal.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRef.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindState.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindUtility.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindVM.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.h" /> <ClInclude Include="..\..\..\Runtime\Math\AABB.h" /> <ClInclude Include="..\..\..\Runtime\Math\FloatConversion.h" /> <ClInclude Include="..\..\..\Runtime\Math\Rect.h" /> <ClInclude Include="..\..\..\Runtime\Math\Vector2.h" /> <ClInclude Include="..\..\..\Runtime\Math\Vector3.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBind.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindClass.hpp" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindConfig.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindEnum.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindGlobalState.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindInternal.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRef.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRefTable.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindState.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindUtility.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindVM.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.h" /> <ClInclude Include="..\..\..\Runtime\Utilities\Assert.h" /> <ClInclude Include="..\..\..\Runtime\Utilities\Base64.h" /> <ClInclude Include="..\..\..\Runtime\Utilities\Exception.h" /> @@ -226,8 +229,8 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <None Include="..\..\..\Runtime\Scripting\LuaBindClass.inc" /> - <None Include="..\..\..\Runtime\Scripting\LuaBindState.inc" /> + <None Include="..\..\..\Runtime\LuaBind\LuaBindClass.inc" /> + <None Include="..\..\..\Runtime\LuaBind\LuaBindState.inc" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj.filters b/Projects/VisualStudio/Editor/Editor.vcxproj.filters index 5c0cfb5..cf4698b 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj.filters +++ b/Projects/VisualStudio/Editor/Editor.vcxproj.filters @@ -19,9 +19,6 @@ <Filter Include="Editor\GUI"> <UniqueIdentifier>{87a57ef1-78d8-42b8-b179-ce1bbb5c4f8b}</UniqueIdentifier> </Filter> - <Filter Include="Runtime\Scripting"> - <UniqueIdentifier>{f9573ff2-4a53-4953-806e-f0ce0c586910}</UniqueIdentifier> - </Filter> <Filter Include="Runtime\Graphics"> <UniqueIdentifier>{6c7e1979-1cd3-40c7-98e1-f063c325d642}</UniqueIdentifier> </Filter> @@ -46,6 +43,18 @@ <Filter Include="Editor\Scripting\IMGUI"> <UniqueIdentifier>{337f607e-8c00-4e7b-a925-9380e08a30f0}</UniqueIdentifier> </Filter> + <Filter Include="Runtime\LuaBind"> + <UniqueIdentifier>{f9573ff2-4a53-4953-806e-f0ce0c586910}</UniqueIdentifier> + </Filter> + <Filter Include="Runtime\Scripting"> + <UniqueIdentifier>{c1e200c9-0eec-40e2-a69f-ccaaaa208200}</UniqueIdentifier> + </Filter> + <Filter Include="Runtime\Scripting\GL"> + <UniqueIdentifier>{0d57b53a-e29a-4ece-a6d8-f5aa13d15891}</UniqueIdentifier> + </Filter> + <Filter Include="Editor\Shaders"> + <UniqueIdentifier>{707a995f-6856-44c8-857c-14e7834e86e3}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\..\Editor\GUI\Dock.cpp"> @@ -66,33 +75,6 @@ <ClCompile Include="..\..\..\Editor\GUI\WinUtils.cpp"> <Filter>Editor\GUI</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindClass.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindEnum.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRef.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRefTable.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindState.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindVM.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.cpp"> - <Filter>Runtime\Scripting</Filter> - </ClCompile> <ClCompile Include="..\..\..\Editor\GUI\ContainnerWindow.cpp"> <Filter>Editor\GUI</Filter> </ClCompile> @@ -150,6 +132,39 @@ <ClCompile Include="..\..\..\Editor\Scripting\IMGUI\GUIButton.bind.cpp"> <Filter>Editor\Scripting\IMGUI</Filter> </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindClass.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindEnum.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRef.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindState.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindVM.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.cpp"> + <Filter>Runtime\LuaBind</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Runtime\Scripting\GL.bind.cpp"> + <Filter>Runtime\Scripting\GL</Filter> + </ClCompile> + <ClCompile Include="..\..\..\Editor\Shaders\BuiltinShaders.cpp"> + <Filter>Editor\Shaders</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\Editor\GUI\Dock.h"> @@ -203,48 +218,6 @@ <ClInclude Include="..\..\..\Editor\GUI\WinUtils.h"> <Filter>Editor\GUI</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBind.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindClass.hpp"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindConfig.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindEnum.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindGlobalState.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindInternal.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRef.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRefTable.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindState.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindUtility.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindVM.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.h"> - <Filter>Runtime\Scripting</Filter> - </ClInclude> <ClInclude Include="..\..\..\Editor\Utils\Log.h"> <Filter>Editor\Utils</Filter> </ClInclude> @@ -266,13 +239,58 @@ <ClInclude Include="..\..\..\Editor\Scripting\EditorScripting.h"> <Filter>Editor\Scripting</Filter> </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBind.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindClass.hpp"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindConfig.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindEnum.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindGlobalState.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindInternal.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRef.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindState.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindUtility.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindVM.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.h"> + <Filter>Runtime\LuaBind</Filter> + </ClInclude> + <ClInclude Include="..\..\..\Editor\Shaders\BuiltinShaders.h"> + <Filter>Editor\Shaders</Filter> + </ClInclude> </ItemGroup> <ItemGroup> - <None Include="..\..\..\Runtime\Scripting\LuaBindClass.inc"> - <Filter>Runtime\Scripting</Filter> + <None Include="..\..\..\Runtime\LuaBind\LuaBindClass.inc"> + <Filter>Runtime\LuaBind</Filter> </None> - <None Include="..\..\..\Runtime\Scripting\LuaBindState.inc"> - <Filter>Runtime\Scripting</Filter> + <None Include="..\..\..\Runtime\LuaBind\LuaBindState.inc"> + <Filter>Runtime\LuaBind</Filter> </None> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Projects/VisualStudio/Runtime/Runtime.vcxproj b/Projects/VisualStudio/Runtime/Runtime.vcxproj index 5ce1d52..2d56bfd 100644 --- a/Projects/VisualStudio/Runtime/Runtime.vcxproj +++ b/Projects/VisualStudio/Runtime/Runtime.vcxproj @@ -38,6 +38,20 @@ <ClInclude Include="..\..\..\Runtime\ImGUI\GUIButton.h" /> <ClInclude Include="..\..\..\Runtime\ImGUI\GUILabel.h" /> <ClInclude Include="..\..\..\Runtime\Input\Input.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBind.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindClass.hpp" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindConfig.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindEnum.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindGlobalState.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindInternal.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRef.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindState.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindUtility.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindVM.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.h" /> <ClInclude Include="..\..\..\Runtime\Math\AABB.h" /> <ClInclude Include="..\..\..\Runtime\Math\Vector2.h" /> <ClInclude Include="..\..\..\Runtime\Math\Vector3.h" /> @@ -50,20 +64,7 @@ <ClInclude Include="..\..\..\Runtime\Physics\Rigidbody.h" /> <ClInclude Include="..\..\..\Runtime\Profiler\FrameStats.h" /> <ClInclude Include="..\..\..\Runtime\Profiler\Profiler.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBind.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindClass.hpp" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindConfig.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindEnum.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindGlobalState.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindInternal.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRef.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRefTable.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindState.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindUtility.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindVM.h" /> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.h" /> + <ClInclude Include="..\..\..\Runtime\Runner.h" /> <ClInclude Include="..\..\..\Runtime\Shaders\ShaderChannel.h" /> <ClInclude Include="..\..\..\Runtime\Shaders\ShaderDefine.h" /> <ClInclude Include="..\..\..\Runtime\Shaders\ShaderUniform.h" /> @@ -101,21 +102,21 @@ <ClCompile Include="..\..\..\Runtime\ImGUI\GUIButton.cpp" /> <ClCompile Include="..\..\..\Runtime\ImGUI\GUILabel.cpp" /> <ClCompile Include="..\..\..\Runtime\Input\Input.cpp" /> - <ClCompile Include="..\..\..\Runtime\main.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindClass.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindEnum.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRef.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindState.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindVM.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.cpp" /> <ClCompile Include="..\..\..\Runtime\Math\Vector2.cpp" /> <ClCompile Include="..\..\..\Runtime\Math\Vector3.cpp" /> <ClCompile Include="..\..\..\Runtime\Mesh\Font.cpp" /> <ClCompile Include="..\..\..\Runtime\Mesh\Mesh.cpp" /> <ClCompile Include="..\..\..\Runtime\Physics\Scripting\wrap_Joint.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindClass.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindEnum.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRef.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRefTable.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindState.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindVM.cpp" /> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.cpp" /> + <ClCompile Include="..\..\..\Runtime\Runner.cpp" /> <ClCompile Include="..\..\..\Runtime\Shaders\ShaderDefine.cpp" /> <ClCompile Include="..\..\..\Runtime\Threads\Mutex.cpp" /> <ClCompile Include="..\..\..\Runtime\Threads\Semaphore.cpp" /> @@ -134,8 +135,8 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <None Include="..\..\..\Runtime\Scripting\LuaBindClass.inc" /> - <None Include="..\..\..\Runtime\Scripting\LuaBindState.inc" /> + <None Include="..\..\..\Runtime\LuaBind\LuaBindClass.inc" /> + <None Include="..\..\..\Runtime\LuaBind\LuaBindState.inc" /> </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> diff --git a/Projects/VisualStudio/Runtime/Runtime.vcxproj.filters b/Projects/VisualStudio/Runtime/Runtime.vcxproj.filters index 8de44e2..86744e8 100644 --- a/Projects/VisualStudio/Runtime/Runtime.vcxproj.filters +++ b/Projects/VisualStudio/Runtime/Runtime.vcxproj.filters @@ -40,15 +40,18 @@ <Filter Include="Graphics\Scripting"> <UniqueIdentifier>{fb970ccc-e9aa-4f61-854c-0b852503a375}</UniqueIdentifier> </Filter> - <Filter Include="Scripting"> - <UniqueIdentifier>{a354c650-8493-41a2-81e5-205495beb0e5}</UniqueIdentifier> - </Filter> <Filter Include="Physics\Scripting"> <UniqueIdentifier>{4478c64f-e27a-4be6-a189-8d99e0fc6b15}</UniqueIdentifier> </Filter> <Filter Include="ImGUI"> <UniqueIdentifier>{c865b35b-5537-4757-927d-7476009f4de2}</UniqueIdentifier> </Filter> + <Filter Include="LuaBind"> + <UniqueIdentifier>{a354c650-8493-41a2-81e5-205495beb0e5}</UniqueIdentifier> + </Filter> + <Filter Include="Scripting"> + <UniqueIdentifier>{e53b1cb1-9d81-47a0-8d40-566d4fd0ef80}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\Runtime\Utilities\NonCopyable.h"> @@ -189,47 +192,48 @@ <ClInclude Include="..\..\..\Runtime\ImGUI\GUILabel.h"> <Filter>ImGUI</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBind.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\Runner.h" /> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBind.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindClass.hpp"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindClass.hpp"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindConfig.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindConfig.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindEnum.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindEnum.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindGlobalState.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindGlobalState.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindInternal.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindInternal.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRef.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRef.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindRefTable.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindState.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindState.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindUtility.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindUtility.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindVM.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindVM.h"> + <Filter>LuaBind</Filter> </ClInclude> - <ClInclude Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.h"> - <Filter>Scripting</Filter> + <ClInclude Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.h"> + <Filter>LuaBind</Filter> </ClInclude> </ItemGroup> <ItemGroup> @@ -245,7 +249,6 @@ <ClCompile Include="..\..\..\Runtime\Graphics\Device.cpp"> <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\main.cpp" /> <ClCompile Include="..\..\..\Runtime\Math\Vector3.cpp"> <Filter>Math</Filter> </ClCompile> @@ -324,40 +327,41 @@ <ClCompile Include="..\..\..\Runtime\ImGUI\GUILabel.cpp"> <Filter>ImGUI</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindCFunctions.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\Runner.cpp" /> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindCFunctions.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindClass.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindClass.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindEnum.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindEnum.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindMemberRef.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindMemberRef.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRef.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRef.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindRefTable.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindRefTable.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindState.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindState.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindVM.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindVM.cpp"> + <Filter>LuaBind</Filter> </ClCompile> - <ClCompile Include="..\..\..\Runtime\Scripting\LuaBindWatchDog.cpp"> - <Filter>Scripting</Filter> + <ClCompile Include="..\..\..\Runtime\LuaBind\LuaBindWatchDog.cpp"> + <Filter>LuaBind</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <None Include="..\..\..\Runtime\Scripting\LuaBindClass.inc"> - <Filter>Scripting</Filter> + <None Include="..\..\..\Runtime\LuaBind\LuaBindClass.inc"> + <Filter>LuaBind</Filter> </None> - <None Include="..\..\..\Runtime\Scripting\LuaBindState.inc"> - <Filter>Scripting</Filter> + <None Include="..\..\..\Runtime\LuaBind\LuaBindState.inc"> + <Filter>LuaBind</Filter> </None> </ItemGroup> </Project>
\ No newline at end of file diff --git a/DefaultContent/Libraries/Framework/Animation/Animation.lua b/Resources/DefaultContent/Libraries/Framework/Animation/Animation.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Animation/Animation.lua +++ b/Resources/DefaultContent/Libraries/Framework/Animation/Animation.lua diff --git a/DefaultContent/Libraries/Framework/Class.lua b/Resources/DefaultContent/Libraries/Framework/Class.lua index 78c577c..78c577c 100644 --- a/DefaultContent/Libraries/Framework/Class.lua +++ b/Resources/DefaultContent/Libraries/Framework/Class.lua diff --git a/DefaultContent/Libraries/Framework/Core/Camera.lua b/Resources/DefaultContent/Libraries/Framework/Core/Camera.lua index 5fcfbe7..5fcfbe7 100644 --- a/DefaultContent/Libraries/Framework/Core/Camera.lua +++ b/Resources/DefaultContent/Libraries/Framework/Core/Camera.lua diff --git a/DefaultContent/Libraries/Framework/Core/Component.lua b/Resources/DefaultContent/Libraries/Framework/Core/Component.lua index 00bf2ca..00bf2ca 100644 --- a/DefaultContent/Libraries/Framework/Core/Component.lua +++ b/Resources/DefaultContent/Libraries/Framework/Core/Component.lua diff --git a/DefaultContent/Libraries/Framework/Core/Game.lua b/Resources/DefaultContent/Libraries/Framework/Core/Game.lua index 51ce25f..51ce25f 100644 --- a/DefaultContent/Libraries/Framework/Core/Game.lua +++ b/Resources/DefaultContent/Libraries/Framework/Core/Game.lua diff --git a/DefaultContent/Libraries/Framework/Core/GameObject.lua b/Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua index ee0d143..ee0d143 100644 --- a/DefaultContent/Libraries/Framework/Core/GameObject.lua +++ b/Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua diff --git a/DefaultContent/Libraries/Framework/Core/Sprite.lua b/Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua index 47cb50d..47cb50d 100644 --- a/DefaultContent/Libraries/Framework/Core/Sprite.lua +++ b/Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua diff --git a/DefaultContent/Libraries/Framework/Math/Matrix44.lua b/Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua index b572f74..b572f74 100644 --- a/DefaultContent/Libraries/Framework/Math/Matrix44.lua +++ b/Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua diff --git a/DefaultContent/Libraries/Framework/Math/Quaternion.lua b/Resources/DefaultContent/Libraries/Framework/Math/Quaternion.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Math/Quaternion.lua +++ b/Resources/DefaultContent/Libraries/Framework/Math/Quaternion.lua diff --git a/DefaultContent/Libraries/Framework/Math/Vector2.lua b/Resources/DefaultContent/Libraries/Framework/Math/Vector2.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Math/Vector2.lua +++ b/Resources/DefaultContent/Libraries/Framework/Math/Vector2.lua diff --git a/DefaultContent/Libraries/Framework/Math/Vector3.lua b/Resources/DefaultContent/Libraries/Framework/Math/Vector3.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Math/Vector3.lua +++ b/Resources/DefaultContent/Libraries/Framework/Math/Vector3.lua diff --git a/DefaultContent/Libraries/Framework/Math/Vector4.lua b/Resources/DefaultContent/Libraries/Framework/Math/Vector4.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Math/Vector4.lua +++ b/Resources/DefaultContent/Libraries/Framework/Math/Vector4.lua diff --git a/DefaultContent/Libraries/Framework/Utils/EventCenter.lua b/Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua index 664ecba..664ecba 100644 --- a/DefaultContent/Libraries/Framework/Utils/EventCenter.lua +++ b/Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua diff --git a/DefaultContent/Libraries/Framework/Utils/StateMachine.lua b/Resources/DefaultContent/Libraries/Framework/Utils/StateMachine.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Utils/StateMachine.lua +++ b/Resources/DefaultContent/Libraries/Framework/Utils/StateMachine.lua diff --git a/DefaultContent/Libraries/Framework/Utils/Util.lua b/Resources/DefaultContent/Libraries/Framework/Utils/Util.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Framework/Utils/Util.lua +++ b/Resources/DefaultContent/Libraries/Framework/Utils/Util.lua diff --git a/DefaultContent/Libraries/Framework/init.lua b/Resources/DefaultContent/Libraries/Framework/init.lua index 8b96176..8b96176 100644 --- a/DefaultContent/Libraries/Framework/init.lua +++ b/Resources/DefaultContent/Libraries/Framework/init.lua diff --git a/DefaultContent/Libraries/Math/Euler.lua b/Resources/DefaultContent/Scripts/Math/Euler.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Math/Euler.lua +++ b/Resources/DefaultContent/Scripts/Math/Euler.lua diff --git a/DefaultContent/Libraries/Math/Matrix4x4.lua b/Resources/DefaultContent/Scripts/Math/Matrix4x4.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Math/Matrix4x4.lua +++ b/Resources/DefaultContent/Scripts/Math/Matrix4x4.lua diff --git a/DefaultContent/Libraries/Math/Quaternion.lua b/Resources/DefaultContent/Scripts/Math/Quaternion.lua index 4c71f52..4c71f52 100644 --- a/DefaultContent/Libraries/Math/Quaternion.lua +++ b/Resources/DefaultContent/Scripts/Math/Quaternion.lua diff --git a/DefaultContent/Libraries/Math/Vector2.lua b/Resources/DefaultContent/Scripts/Math/Vector2.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Math/Vector2.lua +++ b/Resources/DefaultContent/Scripts/Math/Vector2.lua diff --git a/DefaultContent/Libraries/Math/Vector3.lua b/Resources/DefaultContent/Scripts/Math/Vector3.lua index e69de29..e69de29 100644 --- a/DefaultContent/Libraries/Math/Vector3.lua +++ b/Resources/DefaultContent/Scripts/Math/Vector3.lua diff --git a/DefaultContent/Textures/blank.png b/Resources/DefaultContent/Textures/blank.png Binary files differindex 877e031..877e031 100644 --- a/DefaultContent/Textures/blank.png +++ b/Resources/DefaultContent/Textures/blank.png diff --git a/Resources/DefaultContent/readme.txt b/Resources/DefaultContent/readme.txt new file mode 100644 index 0000000..5a01d86 --- /dev/null +++ b/Resources/DefaultContent/readme.txt @@ -0,0 +1,6 @@ +杩愯鏃跺繀椤荤殑鍐呯疆璧勬簮锛屽寘鎷 +* 寮曟搸妯″潡 +* 鎵╁睍妯″潡 +* 鍐呯疆Shader +* 鍐呯疆妯″瀷 +* 鍐呯疆璐村浘
\ No newline at end of file diff --git a/Resources/Scripts/EditorApplication.lua b/Resources/Scripts/EditorApplication.lua new file mode 100644 index 0000000..79686ba --- /dev/null +++ b/Resources/Scripts/EditorApplication.lua @@ -0,0 +1,11 @@ +local Debug = GameLab.Debug + + + +local i = 10 +while i > 0 do + +i= i-1 +print(1) + +end diff --git a/Runtime/Scripting/LuaBind.h b/Runtime/LuaBind/LuaBind.h index 5b0238e..1494b5c 100644 --- a/Runtime/Scripting/LuaBind.h +++ b/Runtime/LuaBind/LuaBind.h @@ -1,9 +1,9 @@ #ifndef __LUA_BIND_H__ #define __LUA_BIND_H__ -/// -/// (port) library 用于给lua注册类和函数 -/// +// +// (port) library 用于给lua注册类和函数 +// #include "LuaBindState.h" #include "LuaBindVM.h" diff --git a/Runtime/Scripting/LuaBindCFunctions.cpp b/Runtime/LuaBind/LuaBindCFunctions.cpp index ca662a3..ca662a3 100644 --- a/Runtime/Scripting/LuaBindCFunctions.cpp +++ b/Runtime/LuaBind/LuaBindCFunctions.cpp diff --git a/Runtime/Scripting/LuaBindCFunctions.h b/Runtime/LuaBind/LuaBindCFunctions.h index 696570e..25ccbc2 100644 --- a/Runtime/Scripting/LuaBindCFunctions.h +++ b/Runtime/LuaBind/LuaBindCFunctions.h @@ -10,14 +10,14 @@ namespace { - /// - /// 获得第一个upvalue - /// + // + // 获得第一个upvalue + // extern int luax_c_getupvalue(lua_State* L); - /// - /// 调用此函数时会报错,upvalue(1)是错误信息 - /// + // + // 调用此函数时会报错,upvalue(1)是错误信息 + // extern int luax_c_errfunc(lua_State* L); } diff --git a/Runtime/Scripting/LuaBindClass.cpp b/Runtime/LuaBind/LuaBindClass.cpp index b6a54b8..7fd603c 100644 --- a/Runtime/Scripting/LuaBindClass.cpp +++ b/Runtime/LuaBind/LuaBindClass.cpp @@ -72,9 +72,9 @@ namespace LuaBind return 1; } - /// - /// New函数接受n个参数,并尝试获取__init,将参数传给__init初始化实例。 - /// + // + // New函数接受n个参数,并尝试获取__init,将参数传给__init初始化实例。 + // int PlainClass::_New(lua_State* L) { LUA_BIND_STATE(L); diff --git a/Runtime/Scripting/LuaBindClass.hpp b/Runtime/LuaBind/LuaBindClass.hpp index 90c421d..c27af4e 100644 --- a/Runtime/Scripting/LuaBindClass.hpp +++ b/Runtime/LuaBind/LuaBindClass.hpp @@ -20,32 +20,32 @@ namespace LuaBind class VM; - /// - /// 虚基类,为了实现多态。需要访问下面这些接口的外部基类需要虚继承此类,之后再派生链中就会 - /// 调用对应实体的方法。注意继承此类时不能实现下面的方法,实现在NativeClass中,实现会 - /// 导致二义性。 - /// - /// 依据Effective C++条款40,如果在必须使用virtual base基类情况下,应该尽可能避免向其中放 - /// 置数据成员,规避数据成员初始化造成的一些隐性问题。依据这一点,vpb基类更加接近C#和Java中 - /// 的Interface。所以,在这里把类用I开头标识这是一个接口。 - /// + // + // 虚基类,为了实现多态。需要访问下面这些接口的外部基类需要虚继承此类,之后再派生链中就会 + // 调用对应实体的方法。注意继承此类时不能实现下面的方法,实现在NativeClass中,实现会 + // 导致二义性。 + // + // 依据Effective C++条款40,如果在必须使用virtual base基类情况下,应该尽可能避免向其中放 + // 置数据成员,规避数据成员初始化造成的一些隐性问题。依据这一点,vpb基类更加接近C#和Java中 + // 的Interface。所以,在这里把类用I开头标识这是一个接口。 + // class Object { public: Object() {}; virtual ~Object() {}; - /// - /// 成员引用管理,在实例的ref table里。设置、取、清除。 - /// + // + // 成员引用管理,在实例的ref table里。设置、取、清除。 + // virtual bool PushMemberRef(State& state, int refID) = 0; virtual bool PushUserdata(State& state) = 0; virtual bool PushMemberTable(State& state) = 0; virtual bool PushRefTable(State& state) = 0; - /// - /// 被NativeClass实现。保持和释放native资源。 - /// + // + // 被NativeClass实现。保持和释放native资源。 + // virtual void Retain() = 0; virtual void Release() = 0; @@ -56,43 +56,43 @@ namespace LuaBind //{ //} - /// - /// 需要暴露给lua的native class需要继承此类。通过lua管理的实例要确保引用计数的正确性,在多个线程中需要确 - /// 定不会误释放。 - /// + // + // 需要暴露给lua的native class需要继承此类。通过lua管理的实例要确保引用计数的正确性,在多个线程中需要确 + // 定不会误释放。 + // template<class TYPE, class BASE = Object> class NativeClass : public BASE { public: - /// - /// 将userdata作为key,在ref table里对userdata添加一个引用,以维持userdata的生命周期。 - /// 相比较member ref,这个用在实体会被多次被不同其他实体引用的情况,并频繁销毁这些实体, - /// 避免lua频繁的调用gc检测。 - /// + // + // 将userdata作为key,在ref table里对userdata添加一个引用,以维持userdata的生命周期。 + // 相比较member ref,这个用在实体会被多次被不同其他实体引用的情况,并频繁销毁这些实体, + // 避免lua频繁的调用gc检测。 + // template<class DATATYPE> void Retain(State& state, DATATYPE* userdata); - /// - /// 对userdata减少一个引用在ref table里,以尝试回收userdata。 - /// + // + // 对userdata减少一个引用在ref table里,以尝试回收userdata。 + // template<class DATATYPE> void Release(State& state, DATATYPE* userdata); - /// - /// 将userdata push到栈顶,如果没有初始化mUserdata,初始化设置好元表并把初始化好的 - /// userdata留在栈顶。并添加一个引用。这是一个将native对象所有权移交给lua控制的方法。 - /// + // + // 将userdata push到栈顶,如果没有初始化mUserdata,初始化设置好元表并把初始化好的 + // userdata留在栈顶。并添加一个引用。这是一个将native对象所有权移交给lua控制的方法。 + // bool PushMemberRef(State& state, int refID) override; bool PushUserdata(State& state) override; bool PushMemberTable(State& state) override; bool PushRefTable(State& state) override; - /// - /// WatchDog添加一个native引用。luaVM引用不会提供外部接口。继承此类的派生类不能直接使用 - /// delete方法,应该使用Release释放。一般情况下这个操作由虚拟机__gc进行,但是允许用户 - /// 程序在native中隔绝虚拟机情况下释放,这种情况下要使用Release。 - /// - /// 这两个函数是native接口。 - /// + // + // WatchDog添加一个native引用。luaVM引用不会提供外部接口。继承此类的派生类不能直接使用 + // delete方法,应该使用Release释放。一般情况下这个操作由虚拟机__gc进行,但是允许用户 + // 程序在native中隔绝虚拟机情况下释放,这种情况下要使用Release。 + // + // 这两个函数是native接口。 + // void Retain() override final; void Release() override final; @@ -106,9 +106,9 @@ namespace LuaBind NativeClass(); virtual ~NativeClass(); - /// - /// 成员引用管理,在实例的ref table里。设置、取、清除 - /// + // + // 成员引用管理,在实例的ref table里。设置、取、清除 + // void SetMemberRef(State& state, MemberRef& memRef, int idx); bool PushMemberRef(State& state, MemberRef& memRef); void ClearMemberRef(State& state, MemberRef& memRef); @@ -124,9 +124,9 @@ namespace LuaBind static void SetClassTableRef(State& state, int idx); static void PushClassTable(State& state); - /// - /// 创建userdata,绑定实例到state。 - /// + // + // 创建userdata,绑定实例到state。 + // void BindToLua(State& state); //------------------------------------------------------------------------------// @@ -148,28 +148,28 @@ namespace LuaBind //--------------------------------------------------------------------------------// - /// - /// class table,工厂和单例都有。 - /// + // + // class table,工厂和单例都有。 + // static StrongRef mClassTable; - /// - /// 如果类是单例,这个用来保存singleton的引用关系,以保证不会被回收类似普通类的ref table。 - /// 单例的成员是全生命周期的,所以直接在_LUA_BIND_STRONGREF_TABLE。单例对userdata进行 - /// Retain\Release和member ref操作时和工厂实例不同,是存在下面这个ref table里 - /// 的,这个table在_LUA_BIND_STRONGREF_TABLE里。 - /// + // + // 如果类是单例,这个用来保存singleton的引用关系,以保证不会被回收类似普通类的ref table。 + // 单例的成员是全生命周期的,所以直接在_LUA_BIND_STRONGREF_TABLE。单例对userdata进行 + // Retain\Release和member ref操作时和工厂实例不同,是存在下面这个ref table里 + // 的,这个table在_LUA_BIND_STRONGREF_TABLE里。 + // static StrongRef mSingletonRefTable; - /// - /// 通过userdata可以拿到: - /// 1: ref table - /// 2: member table - /// 3: class table - /// + // + // 通过userdata可以拿到: + // 1: ref table + // 2: member table + // 3: class table + // WeakRef mUserdata; - /// 通过后才能删除 + // 通过后才能删除 WatchDog mWatchDog; #if LUA_BIND_PROFILER @@ -182,16 +182,16 @@ namespace LuaBind }; #if LUA_BIND_ENABLE_PLAIN_CLASS - /// - /// 纯lua类 - /// + // + // 纯lua类 + // class PlainClass { public: - /// - /// 用来注册类的入口函数。可以通过registry(类名)注册类。 - /// + // + // 用来注册类的入口函数。可以通过registry(类名)注册类。 + // static int registry(lua_State* L); LUA_BIND_DECL_METHOD(__tostring); diff --git a/Runtime/Scripting/LuaBindClass.inc b/Runtime/LuaBind/LuaBindClass.inc index e9c7b8b..1d05f98 100644 --- a/Runtime/Scripting/LuaBindClass.inc +++ b/Runtime/LuaBind/LuaBindClass.inc @@ -3,9 +3,9 @@ namespace LuaBind //--------------------------------------------------------------------------------// - /// - /// 对不同类型,通过调用GetLuaClassName获得类型名,如果是派生类,GetClassName会被覆盖,指向luax_c_getupvalue。 - /// + // + // 对不同类型,通过调用GetLuaClassName获得类型名,如果是派生类,GetClassName会被覆盖,指向luax_c_getupvalue。 + // template<class TYPE, class BASE> int NativeClass<TYPE, BASE>::_GetClassName(lua_State* L) { @@ -18,9 +18,9 @@ namespace LuaBind //--------------------------------------------------------------------------------// - /// - /// 注册工厂和单例共有的类成员 - /// + // + // 注册工厂和单例共有的类成员 + // template<class TYPE, class BASE> void NativeClass<TYPE, BASE>::RegisterClassShared(State& state) { @@ -33,9 +33,9 @@ namespace LuaBind state.RegisterMethods(regTable); } - /// - /// 工厂类的成员,注册在class table - /// + // + // 工厂类的成员,注册在class table + // template<class TYPE, class BASE> void NativeClass<TYPE, BASE>::RegisterFactoryClass(State& state) { @@ -47,9 +47,9 @@ namespace LuaBind state.RegisterMethods(regTable); } - /// - /// 单例类的成员,注册在class table - /// + // + // 单例类的成员,注册在class table + // template<class TYPE, class BASE> void NativeClass<TYPE, BASE>::RegisterSingletonClass(State& state) { @@ -238,15 +238,15 @@ namespace LuaBind return false; } - /// - /// 创建userdata,并以此添加ref table,member table和class table。 - /// ref table 是kv强引用table,保存对其他userdata的引用计数(通过userdata作为key, - /// 计数为value),以及成员引用 - /// member table 保存lua创建的实例的成员 - /// class table 所有本类型的实例共有的函数表 - /// - /// BindToLua只会在第一次注册给Lua虚拟机时调用。 - /// + // + // 创建userdata,并以此添加ref table,member table和class table。 + // ref table 是kv强引用table,保存对其他userdata的引用计数(通过userdata作为key, + // 计数为value),以及成员引用 + // member table 保存lua创建的实例的成员 + // class table 所有本类型的实例共有的函数表 + // + // BindToLua只会在第一次注册给Lua虚拟机时调用。 + // template<class TYPE, class BASE> void NativeClass<TYPE, BASE>::BindToLua(State& state) { @@ -254,11 +254,11 @@ namespace LuaBind assert(!TYPE::IsClassSingleton()); assert(!mUserdata); - /// - /// 创建userdata并留在栈顶,注意地址要转换为TYPE*,直接用this可能会导致多重继承的类丧失多态。 - /// 如果直接传this进去,在多重继承情况下,是拿不到另一头的虚函数表的。所以这里需要将this - /// 转换为整个对象的低地址,这样可以拿到另一个基类的虚函数表,通过另一个基类实现多态。 - /// + // + // 创建userdata并留在栈顶,注意地址要转换为TYPE*,直接用this可能会导致多重继承的类丧失多态。 + // 如果直接传this进去,在多重继承情况下,是拿不到另一头的虚函数表的。所以这里需要将this + // 转换为整个对象的低地址,这样可以拿到另一个基类的虚函数表,通过另一个基类实现多态。 + // TYPE* p = static_cast<TYPE*>(this); state.PushPtrUserdata(p); @@ -306,9 +306,9 @@ namespace LuaBind #endif } - /// - /// 成员引用管理 - /// + // + // 成员引用管理 + // template<class TYPE, class BASE> void NativeClass<TYPE, BASE>::SetMemberRef(State& state, MemberRef& memRef, int idx) { @@ -377,9 +377,9 @@ namespace LuaBind //--------------------------------------------------------------------------------// - /// - /// 释放工厂创建的实例 - /// + // + // 释放工厂创建的实例 + // template<class TYPE, class BASE> int NativeClass<TYPE, BASE>::__gc(lua_State* L) { @@ -400,10 +400,10 @@ namespace LuaBind return 0; } - /// - /// 输出格式如下: - /// 地址 类名 - /// + // + // 输出格式如下: + // 地址 类名 + // template<class TYPE, class BASE> int NativeClass<TYPE, BASE>::__tostring(lua_State* L) { @@ -433,10 +433,10 @@ namespace LuaBind } #if LUA_BIND_ENABLE_NATIVE_EXTEND - /// - /// 派生出子类,在lua里对派生类的成员和行为进行重新设计,但是保证了userdata的统一。Native class的派生提供__init支持,在 - /// native实体创建后可以使用__init进行初始化,派生类拥有和基类一样的New参数列表,且native对象是一样的类型。 - /// + // + // 派生出子类,在lua里对派生类的成员和行为进行重新设计,但是保证了userdata的统一。Native class的派生提供__init支持,在 + // native实体创建后可以使用__init进行初始化,派生类拥有和基类一样的New参数列表,且native对象是一样的类型。 + // template<class TYPE, class BASE> int NativeClass<TYPE, BASE>::_ExtendFactory(lua_State* L) { diff --git a/Runtime/Scripting/LuaBindConfig.h b/Runtime/LuaBind/LuaBindConfig.h index 72709bd..72709bd 100644 --- a/Runtime/Scripting/LuaBindConfig.h +++ b/Runtime/LuaBind/LuaBindConfig.h diff --git a/Runtime/Scripting/LuaBindEnum.cpp b/Runtime/LuaBind/LuaBindEnum.cpp index ecf4a9f..63e2567 100644 --- a/Runtime/Scripting/LuaBindEnum.cpp +++ b/Runtime/LuaBind/LuaBindEnum.cpp @@ -5,9 +5,9 @@ namespace LuaBind { - /// - /// 只读metatable的__index - /// + // + // 只读metatable的__index + // int _rmt__index(lua_State* L) { // params: diff --git a/Runtime/Scripting/LuaBindEnum.h b/Runtime/LuaBind/LuaBindEnum.h index dbbd2f2..122e845 100644 --- a/Runtime/Scripting/LuaBindEnum.h +++ b/Runtime/LuaBind/LuaBindEnum.h @@ -6,9 +6,9 @@ namespace LuaBind { - /// - /// 导出枚举,枚举是一类不可修改整型集合,枚举的值在 - /// + // + // 导出枚举,枚举是一类不可修改整型集合,枚举的值在 + // struct Enum { cc8* name; @@ -22,9 +22,9 @@ namespace LuaBind //--------------------------------------------------------------------------------// #if LUA_BIND_ENABLE_PLAIN_ENUM - /// - /// 纯lua的枚举,创建不可修改的table - /// + // + // 纯lua的枚举,创建不可修改的table + // class PlainEnum { public: diff --git a/Runtime/Scripting/LuaBindGlobalState.h b/Runtime/LuaBind/LuaBindGlobalState.h index fa3cc4f..fa3cc4f 100644 --- a/Runtime/Scripting/LuaBindGlobalState.h +++ b/Runtime/LuaBind/LuaBindGlobalState.h diff --git a/Runtime/Scripting/LuaBindInternal.h b/Runtime/LuaBind/LuaBindInternal.h index 99f45d0..1d4a226 100644 --- a/Runtime/Scripting/LuaBindInternal.h +++ b/Runtime/LuaBind/LuaBindInternal.h @@ -1,9 +1,9 @@ #ifndef __LUA_BIND_INTERNAL_H__ #define __LUA_BIND_INTERNAL_H__ -/// -/// 对lua源代码的深度使用 -/// +// +// 对lua源代码的深度使用 +// extern "C" { #include "ThirdParty/lua51/lstate.h" diff --git a/Runtime/Scripting/LuaBindMemberRef.cpp b/Runtime/LuaBind/LuaBindMemberRef.cpp index e680cce..e680cce 100644 --- a/Runtime/Scripting/LuaBindMemberRef.cpp +++ b/Runtime/LuaBind/LuaBindMemberRef.cpp diff --git a/Runtime/Scripting/LuaBindMemberRef.h b/Runtime/LuaBind/LuaBindMemberRef.h index 9dbd36b..045d6ef 100644 --- a/Runtime/Scripting/LuaBindMemberRef.h +++ b/Runtime/LuaBind/LuaBindMemberRef.h @@ -6,10 +6,10 @@ namespace LuaBind { - /// - /// 实例的ref table保存的member ref。由luax class做具体的管理。实例的ref table是强引用,用来管理里面member的生命周期。 - /// 用来在lua和native之间进行数据沟通。 - /// + // + // 实例的ref table保存的member ref。由luax class做具体的管理。实例的ref table是强引用,用来管理里面member的生命周期。 + // 用来在lua和native之间进行数据沟通。 + // class MemberRef { public: diff --git a/Runtime/Scripting/LuaBindRef.cpp b/Runtime/LuaBind/LuaBindRef.cpp index 00a65d0..00a65d0 100644 --- a/Runtime/Scripting/LuaBindRef.cpp +++ b/Runtime/LuaBind/LuaBindRef.cpp diff --git a/Runtime/Scripting/LuaBindRef.h b/Runtime/LuaBind/LuaBindRef.h index 7628547..93b30be 100644 --- a/Runtime/Scripting/LuaBindRef.h +++ b/Runtime/LuaBind/LuaBindRef.h @@ -7,9 +7,9 @@ namespace LuaBind { - /// - /// 引用,存在LUA_REGISTRYINDEX下面的两个表里 - /// + // + // 引用,存在LUA_REGISTRYINDEX下面的两个表里 + // class Ref { public: @@ -37,9 +37,9 @@ namespace LuaBind }; - /// - /// 强引用,在LUA_REGISTRYINDEX["_LUA_BIND_STRONGREF_TABLE"]里,保证lua object不会被回收。 - /// + // + // 强引用,在LUA_REGISTRYINDEX["_LUA_BIND_STRONGREF_TABLE"]里,保证lua object不会被回收。 + // class StrongRef: public Ref { public: @@ -47,9 +47,9 @@ namespace LuaBind }; - /// - /// 弱引用,在LUA_REGISTRYINDEX["_LUA_BIND_WEAKREF_TABLE"]里,不影响lua object的回收,只是作为一个方便取lua object的映射。 - /// + // + // 弱引用,在LUA_REGISTRYINDEX["_LUA_BIND_WEAKREF_TABLE"]里,不影响lua object的回收,只是作为一个方便取lua object的映射。 + // class WeakRef : public Ref { public: diff --git a/Runtime/Scripting/LuaBindRefTable.cpp b/Runtime/LuaBind/LuaBindRefTable.cpp index 39ef9ab..39ef9ab 100644 --- a/Runtime/Scripting/LuaBindRefTable.cpp +++ b/Runtime/LuaBind/LuaBindRefTable.cpp diff --git a/Runtime/Scripting/LuaBindRefTable.h b/Runtime/LuaBind/LuaBindRefTable.h index 1cc2af3..0d4c2d4 100644 --- a/Runtime/Scripting/LuaBindRefTable.h +++ b/Runtime/LuaBind/LuaBindRefTable.h @@ -8,9 +8,9 @@ namespace LuaBind class State; - /// - /// ref table 管理,对strong ref table和weak ref table两个table的代理。 - /// + // + // ref table 管理,对strong ref table和weak ref table两个table的代理。 + // class RefTable { public: @@ -31,25 +31,25 @@ namespace LuaBind bool IsKeyWeak(); bool IsValueWeak(); - /// - /// 对stack[idx]的实体在此ref table中增加一个引用,并返回refID - /// + // + // 对stack[idx]的实体在此ref table中增加一个引用,并返回refID + // int Ref(State& state, int idx); void Unref(State& state, int refID); - /// - /// 将此 ref table 放在栈顶 - /// + // + // 将此 ref table 放在栈顶 + // void PushRefTable(State& state); - /// - /// 将 reftable[refID] 放在栈顶 - /// + // + // 将 reftable[refID] 放在栈顶 + // void PushRef(State& state, int refID); - /// - /// 清空 ref table,表还留在LUA_REGISTRYINDEX[mName] - /// + // + // 清空 ref table,表还留在LUA_REGISTRYINDEX[mName] + // void Clear(State& state); private: diff --git a/Runtime/Scripting/LuaBindState.cpp b/Runtime/LuaBind/LuaBindState.cpp index 2b699f5..a9520a8 100644 --- a/Runtime/Scripting/LuaBindState.cpp +++ b/Runtime/LuaBind/LuaBindState.cpp @@ -97,6 +97,11 @@ namespace LuaBind luaL_dostring(mState, code.c_str()); } + void State::DoFile(const std::string & path) + { + luaL_dofile(mState, path.c_str()); + } + int State::AbsIndex(int idx) { /* @@ -710,7 +715,7 @@ namespace LuaBind { assert(lua_istable(mState, -1)); lua_pushcfunction(mState, func); - lua_setfield(mState, -1, fname); + lua_setfield(mState, -2, fname); } void State::RegisterPreloader(cc8* libname, lua_CFunction preloader) @@ -837,9 +842,9 @@ namespace LuaBind return luaL_checkstring(mState, idx); } - /// - /// check light userdata - /// + // + // check light userdata + // template <> const void* State::CheckValue < const void* >(int idx) { diff --git a/Runtime/Scripting/LuaBindState.h b/Runtime/LuaBind/LuaBindState.h index ea8cf5b..776b23d 100644 --- a/Runtime/Scripting/LuaBindState.h +++ b/Runtime/LuaBind/LuaBindState.h @@ -15,15 +15,13 @@ namespace LuaBind class StrongRef; class WeakRef; - /// - /// 对lua_State的代理,除了保存一个lua_State的引用不保存其他内容。一个实例的metatable如下: - /// class table - /// member table - /// ref table - /// userdata - /// 从userdata通过getmetatable获取上级metatable。除此之外还有一个class table注册在对应 - /// 的名称空间里。 - /// + // 对lua_State的代理,除了保存一个lua_State的引用不保存其他内容。一个实例的metatable如下: + // class table + // member table + // ref table + // userdata + // 从userdata通过getmetatable获取上级metatable。除此之外还有一个class table注册在对应 + // 的名称空间里。 LUA_BIND_API class State { public: @@ -37,9 +35,7 @@ namespace LuaBind inline operator lua_State*() { return mState; } inline operator bool() { return mState != nullptr; }; - /// - /// 获取绑定的lua_State - /// + // 获取绑定的lua_State inline lua_State* GetHandle() { return mState; }; global_State* GetGlobalState(); @@ -111,14 +107,10 @@ namespace LuaBind void Push(const void* value); void Push(std::string value); - /// - /// 将idx开始的n个push到栈顶,idx会被取正,n向上生长。 - /// + // 将idx开始的n个push到栈顶,idx会被取正,n向上生长。 void PushValues(int idx, int n); - /// - /// 以void** 的形式创建userdata,并将值设置为ptr - /// + // 以void** 的形式创建userdata,并将值设置为ptr void PushPtrUserdata(void* ptr); void Pop(int n = 1); @@ -150,54 +142,36 @@ namespace LuaBind //------------------------------------------------------------------------------// // 注册方法 - /// - /// 注册工厂,适用于普通类,有New方法 - /// + // 注册工厂,适用于普通类,有New方法 template<class TYPE> void RegisterFactory(); - /// - /// 注册单例,没有New方法 - /// + // 注册单例,没有New方法 template<class TYPE> void RegisterSingleton(); - /// - /// 注册枚举 - /// + // 注册枚举 void RegisterEnum(cc8* name, Enum* enums); - /// - /// 注册C函数,注意后面加一行{0, 0} - /// + // 注册C函数,注意后面加一行{0, 0} void RegisterMethods(const luaL_Reg *l); - /// - /// 注册单个C函数 - /// + // 注册单个C函数 void RegisterMethod(cc8* fname, lua_CFunction func); - /// - /// 把preloader加到package.preload里,当require"libname"时lua的loader_preload根据 - /// libname找到preloader直接加载。用来实现需要require的时候才加载,并且加载过一次后 - /// package.loaded记录下来,下次不会再加载。通过require会调用这个preloader。 - /// + // 把preloader加到package.preload里,当require"libname"时lua的loader_preload根据 + // libname找到preloader直接加载。用来实现需要require的时候才加载,并且加载过一次后 + // package.loaded记录下来,下次不会再加载。通过require会调用这个preloader。 void RegisterPreloader(cc8* libname, lua_CFunction preloader); - /// - /// 根据luaL_Reg建立lib table,并在_G和package.loaded建立对libname的索引,指向lib table。 - /// + // 根据luaL_Reg建立lib table,并在_G和package.loaded建立对libname的索引,指向lib table。 void RegisterLib(cc8* libname, const luaL_Reg* l); #if LUA_BIND_ENABLE_PLAIN_CLASS - /// - /// 注册纯lua类的注册函数,用来创建纯lua类。 - /// + // 注册纯lua类的注册函数,用来创建纯lua类。 void RegisterPlainClassRegistry(cc8* name); #endif #if LUA_BIND_ENABLE_PLAIN_ENUM - /// - /// 注册纯lua的枚举,以防止修改枚举值。 - /// + // 注册纯lua的枚举,以防止修改枚举值。 void RegisterPlainEnumRegistry(cc8* name); #endif @@ -205,9 +179,7 @@ namespace LuaBind friend class VM; - /// - /// 屏蔽对State的地址相关操作 - /// + // 屏蔽对State的地址相关操作 void* operator &(); void* operator new(size_t size); @@ -250,9 +222,7 @@ namespace LuaBind template <> std::string State::CheckValue < std::string >(int idx); template <> const void* State::CheckValue < const void* >(int idx); - /// - /// 在成员方法里创建State并对参数进行检查。 - /// + // 在成员方法里创建State并对参数进行检查。 #define LUA_BIND_SETUP(L, params) \ LuaBind::State state(L); \ if(!state.CheckParams(1, params)) return 0 @@ -262,9 +232,7 @@ namespace LuaBind //--------------------------------------------------------------------------------// - /// - /// 确保不安全的lua调用能够在调用之后返回到最初stack状态。 - /// + // 确保不安全的lua调用能够在调用之后返回到最初stack状态。 class ScopedState : public State { diff --git a/Runtime/Scripting/LuaBindState.inc b/Runtime/LuaBind/LuaBindState.inc index 27151ff..4e7090d 100644 --- a/Runtime/Scripting/LuaBindState.inc +++ b/Runtime/LuaBind/LuaBindState.inc @@ -1,9 +1,9 @@ namespace LuaBind { - /// - /// 注册工厂,注册class table,以type name为键设置在名称空间上。在注册阶段不会设置元表,等到New方法调用的时候才会。 - /// + // + // 注册工厂,注册class table,以type name为键设置在名称空间上。在注册阶段不会设置元表,等到New方法调用的时候才会。 + // template<class TYPE> void State::RegisterFactory() { @@ -53,9 +53,9 @@ namespace LuaBind TYPE::RegisterPostprocess(state); } - /// - /// Singleton - /// + // + // Singleton + // template<typename TYPE> void State::RegisterSingleton() { diff --git a/Runtime/Scripting/LuaBindUtility.h b/Runtime/LuaBind/LuaBindUtility.h index 4d3d542..edc5b18 100644 --- a/Runtime/Scripting/LuaBindUtility.h +++ b/Runtime/LuaBind/LuaBindUtility.h @@ -3,8 +3,8 @@ // 导出native接口 -/// RegisterClass 注册类的方法和成员,比如枚举、常量等到class table GetFactoryName 获得工厂的类名, -/// 同时用来避免注册时错误注册为了singleton,通过编译时报错避免 +// RegisterClass 注册类的方法和成员,比如枚举、常量等到class table GetFactoryName 获得工厂的类名, +// 同时用来避免注册时错误注册为了singleton,通过编译时报错避免 #define LUA_BIND_DECL_FACTORY(type, ...) \ friend class ::State; \ friend class ::NativeClass<type,##__VA_ARGS__>; \ @@ -14,12 +14,12 @@ static const char* GetClassName() { return #type; };\ static bool IsClassSingleton() { return false; } -/// 作为基类的抽象工厂类可以使用此宏,注册一个入口,在派生类的注册函数中调用,注册基类的这些方法。 +// 作为基类的抽象工厂类可以使用此宏,注册一个入口,在派生类的注册函数中调用,注册基类的这些方法。 #define LUA_BIND_DECL_ABSTRACT_FACTORY() \ static void RegisterClass(::State&);\ static void RegisterPostprocess(::State&) -/// RegisterClass 注册类的方法和成员,比如枚举、常量等到class table GetSingletonName 获得单例的类名 +// RegisterClass 注册类的方法和成员,比如枚举、常量等到class table GetSingletonName 获得单例的类名 #define LUA_BIND_DECL_SINGLETON(type, ...) \ friend class ::State; \ friend class ::NativeClass<type,##__VA_ARGS__>; \ @@ -33,14 +33,14 @@ #define LUA_BIND_DECL_ENUM(e, under_line_index) -/// 标明方法实现的宏。上下文里有一个L。 +// 标明方法实现的宏。上下文里有一个L。 #define LUA_BIND_IMPL_METHOD(type, f) int type::f(lua_State* L) -/// 由应用程序实现的两个接口。上下文里有一个state。 +// 由应用程序实现的两个接口。上下文里有一个state。 #define LUA_BIND_REGISTRY(type) void type::RegisterClass(::State& state) #define LUA_BIND_POSTPROCESS(type) void type::RegisterPostprocess(::State& state) -/// 用来注册的宏。之前这里忘了用可变宏,导致没有luaclastable ref没有注册对。 +// 用来注册的宏。之前这里忘了用可变宏,导致没有luaclastable ref没有注册对。 #define LUA_BIND_REGISTER_FACTORY(state, param) state.RegisterFactory<param>() #define LUA_BIND_REGISTER_SINGLETON(state, param) state.RegisterSingleton<param>() #define LUA_BIND_REGISTER_ABSTRACT_FACTORY(state, type) type::RegisterPostprocess(state) diff --git a/Runtime/Scripting/LuaBindVM.cpp b/Runtime/LuaBind/LuaBindVM.cpp index 4677650..268a5ed 100644 --- a/Runtime/Scripting/LuaBindVM.cpp +++ b/Runtime/LuaBind/LuaBindVM.cpp @@ -42,8 +42,8 @@ namespace LuaBind { LUA_BIND_STATE(mMainThread); - mStrongRefTable.Init(state, "UNIVERSAL_STRONGREF_TABLE"); - mWeakRefTable.Init(state, "UNIVERSAL_WEAKREF_TABLE", "v"); + mStrongRefTable.Init(state, "GAMELAB_UNIVERSAL_STRONG_REFERENCE_TABLE"); + mWeakRefTable.Init(state, "GAMELAB_UNIVERSAL_WEAK_REFERENCE_TABLE", "v"); } lua_State* VM::CreateThread() @@ -73,4 +73,10 @@ namespace LuaBind return mWeakRefTable; } + void VM::OpenLibs() + { + assert(mMainThread); + luaL_openlibs(mMainThread); + } + }
\ No newline at end of file diff --git a/Runtime/Scripting/LuaBindVM.h b/Runtime/LuaBind/LuaBindVM.h index 287f906..3bfe899 100644 --- a/Runtime/Scripting/LuaBindVM.h +++ b/Runtime/LuaBind/LuaBindVM.h @@ -12,26 +12,21 @@ namespace LuaBind { - /// - /// 单个lua_state相关的context。是一系列代理的集合,拷贝也没关系,主要是为了节约内存。 - /// + // 单个lua_state相关的context。是一系列代理的集合,拷贝也没关系,主要是为了节约内存。 class VM { public: - /// - /// 根据global_State拿到虚拟机。 - /// + // 根据global_State拿到虚拟机。 static VM* TryGetVM(global_State* gState); static VM* TryGetVM(lua_State* state); VM(); ~VM(); - /// - /// 创建虚拟机后,需要手动调用Setup函数,初始化一些虚拟机状态。 - /// + // 创建虚拟机后,需要手动调用Setup函数,初始化一些虚拟机状态。 void Setup(); + void OpenLibs(); lua_State* GetMainThread(); lua_State* CreateThread(); @@ -46,8 +41,8 @@ namespace LuaBind static VMap VMs; // 通过global_State索引虚拟机,为了方便 - RefTable mStrongRefTable; // _LUA_BIND_STRONGREF_TABLE - RefTable mWeakRefTable; // _LUA_BIND_WEAKREF_TABLE + RefTable mStrongRefTable; // GAMELAB_UNIVERSAL_STRONG_REFERENCE_TABLE + RefTable mWeakRefTable; // GAMELAB_UNIVERSAL_WEAK_REFERENCE_TABLE global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享 lua_State* mMainThread; // 主线程 diff --git a/Runtime/Scripting/LuaBindWatchDog.cpp b/Runtime/LuaBind/LuaBindWatchDog.cpp index e69de29..e69de29 100644 --- a/Runtime/Scripting/LuaBindWatchDog.cpp +++ b/Runtime/LuaBind/LuaBindWatchDog.cpp diff --git a/Runtime/Scripting/LuaBindWatchDog.h b/Runtime/LuaBind/LuaBindWatchDog.h index 44d1d35..794faa9 100644 --- a/Runtime/Scripting/LuaBindWatchDog.h +++ b/Runtime/LuaBind/LuaBindWatchDog.h @@ -6,9 +6,9 @@ namespace LuaBind { - /// - /// NativeClass实例的引用计数额watch dog,只有在watch dog通过时才可以delete。 - /// + // + // NativeClass实例的引用计数额watch dog,只有在watch dog通过时才可以delete。 + // class WatchDog { public: diff --git a/Runtime/Math/FloatConversion.h b/Runtime/Math/FloatConversion.h index e5c0f23..96a4d1d 100644 --- a/Runtime/Math/FloatConversion.h +++ b/Runtime/Math/FloatConversion.h @@ -189,7 +189,7 @@ inline double Roundf(double f) } -/// Fast conversion of float [0...1] to 0 ... 65535 +// Fast conversion of float [0...1] to 0 ... 65535 inline int NormalizedToWord(float f) { f = FloatMax(f, 0.0F); @@ -197,14 +197,14 @@ inline int NormalizedToWord(float f) return RoundfToIntPos(f * 65535.0f); } -/// Fast conversion of float [0...1] to 0 ... 65535 +// Fast conversion of float [0...1] to 0 ... 65535 inline float WordToNormalized(int p) { AssertIf(p < 0 || p > 65535); return (float)p / 65535.0F; } -/// Fast conversion of float [0...1] to 0 ... 255 +// Fast conversion of float [0...1] to 0 ... 255 inline int NormalizedToByte(float f) { f = FloatMax(f, 0.0F); @@ -212,7 +212,7 @@ inline int NormalizedToByte(float f) return RoundfToIntPos(f * 255.0f); } -/// Fast conversion of float [0...1] to 0 ... 255 +// Fast conversion of float [0...1] to 0 ... 255 inline float ByteToNormalized(int p) { AssertIf(p < 0 || p > 255); @@ -249,7 +249,7 @@ inline bool CompareApproximately(float f0, float f1, float epsilon = 0.000001F) return dist < epsilon; } -/// CopySignf () returns x with its sign changed to y's. +// CopySignf () returns x with its sign changed to y's. inline float CopySignf(float x, float y) { union @@ -389,17 +389,17 @@ inline bool IsFinite(const double& value) inline float InvSqrt(float p) { return 1.0F / sqrt(p); } inline float Sqrt(float p) { return sqrt(p); } -/// - Almost highest precision sqrt -/// - Returns 0 if value is 0 or -1 -/// inline float FastSqrt (float value) +// - Almost highest precision sqrt +// - Returns 0 if value is 0 or -1 +// inline float FastSqrt (float value) -/// - Almost highest precision inv sqrt -/// - if value == 0 or -0 it returns 0. -/// inline float FastInvSqrt (float value) +// - Almost highest precision inv sqrt +// - if value == 0 or -0 it returns 0. +// inline float FastInvSqrt (float value) -/// - Low precision inv sqrt approximately -/// - if value == 0 or -0 it returns nan or undefined -/// inline float FastestInvSqrt (float value) +// - Low precision inv sqrt approximately +// - if value == 0 or -0 it returns nan or undefined +// inline float FastestInvSqrt (float value) #if defined(__ppc__) || defined(SN_TARGET_PS3) @@ -426,8 +426,8 @@ inline float FastSqrt(float x) return x; } #else -/// - Accurate to 1 bit precision -/// - returns zero if x is zero +// - Accurate to 1 bit precision +// - returns zero if x is zero inline float FastSqrt(float x) { const float half = 0.5; @@ -459,8 +459,8 @@ inline float FastSqrt(float x) } #endif -/// - Accurate to 1 bit precision -/// - returns zero if f is zero +// - Accurate to 1 bit precision +// - returns zero if f is zero inline float FastInvSqrt(float f) { float result; @@ -486,7 +486,7 @@ inline float FastInvSqrt(float f) return result; } -/// Fast inverse sqrt function +// Fast inverse sqrt function inline float FastestInvSqrt(float value) { #if defined (__ppc__) && (defined (__MWERKS__) || defined(SN_TARGET_PS3)) diff --git a/Runtime/Math/Rect.h b/Runtime/Math/Rect.h index 3b4f16c..dbd147c 100644 --- a/Runtime/Math/Rect.h +++ b/Runtime/Math/Rect.h @@ -3,7 +3,7 @@ #include "Vector2.h" -/// A rectangle. +// A rectangle. template <typename T> class RectT { @@ -11,21 +11,21 @@ public: typedef RectT<T> RectType; typedef float BaseType; - T x; ///< Rectangle x coordinate. - T y; ///< Rectangle y coordinate. - T width; ///< Rectangle width. - T height; ///< Rectangle height. + T x; //< Rectangle x coordinate. + T y; //< Rectangle y coordinate. + T width; //< Rectangle width. + T height; //< Rectangle height. inline static const char* GetTypeString(); inline static bool IsAnimationChannel() { return false; } inline static bool MightContainPPtr() { return false; } - /// Create a empty rectangle. + // Create a empty rectangle. RectT() { Reset(); } - /// Create a new rectangle. + // Create a new rectangle. RectT(T inX, T inY, T iWidth, T iHeight) { x = inX; width = iWidth; @@ -43,7 +43,7 @@ public: T GetXMax() const { return x + width; } T GetYMax() const { return y + height; } - /// Return true if rectangle is empty. + // Return true if rectangle is empty. inline bool IsEmpty() const { return width <= 0 || height <= 0; } inline void SetPosition(const Vector2f& position) { x = position.x; y = position.y; } @@ -51,10 +51,10 @@ public: inline void SetSize(const Vector2f& size) { width = size.x; height = size.y; } inline Vector2f GetSize() const { return Vector2f(width, height); } - /// Resets the rectangle + // Resets the rectangle inline void Reset() { x = y = width = height = 0; } - /// Sets the rectangle + // Sets the rectangle inline void Set(T inX, T inY, T iWidth, T iHeight) { x = inX; width = iWidth; @@ -63,11 +63,11 @@ public: inline void Scale(T dx, T dy) { x *= dx; width *= dx; y *= dy; height *= dy; } - /// Set Center position of rectangle (size stays the same) + // Set Center position of rectangle (size stays the same) void SetCenterPos(T cx, T cy) { x = cx - width / 2; y = cy - height / 2; } Vector2f GetCenterPos() const { return Vector2f(x + (BaseType)width / 2, y + (BaseType)height / 2); } - /// Ensure this is inside the rect r. + // Ensure this is inside the rect r. void Clamp(const RectType &r) { T x2 = x + width; @@ -87,19 +87,19 @@ public: if (height < 0) height = 0; } - /// Move rectangle by deltaX, deltaY. + // Move rectangle by deltaX, deltaY. inline void Move(T dX, T dY) { x += dX; y += dY; } - /// Return the width of rectangle. + // Return the width of rectangle. inline T Width() const { return width; } - /// Return the height of rectangle. + // Return the height of rectangle. inline T Height() const { return height; } - /// Return true if a point lies within rectangle bounds. + // Return true if a point lies within rectangle bounds. inline bool Contains(T px, T py) const { return (px >= x) && (px < x + width) && (py >= y) && (py < y + height); } inline bool Contains(const Vector2f& p) const { return Contains(p.x, p.y); } - /// Return true if a relative point lies within rectangle bounds. + // Return true if a relative point lies within rectangle bounds. inline bool ContainsRel(T x, T y) const { return (x >= 0) && (x < Width()) && (y >= 0) && (y < Height()); @@ -115,7 +115,7 @@ public: return !disjoint; } - /// Normalize a rectangle such that xmin <= xmax and ymin <= ymax. + // Normalize a rectangle such that xmin <= xmax and ymin <= ymax. inline void Normalize() { width = std::max<T>(width, 0); @@ -138,7 +138,7 @@ inline bool CompareApproximately(const Rectf& lhs, const Rectf& rhs) CompareApproximately(lhs.width, rhs.width) && CompareApproximately(lhs.height, rhs.height); } -/// Make a rect with width & height +// Make a rect with width & height template<typename T> inline RectT<T> MinMaxRect(T minx, T miny, T maxx, T maxy) { return RectT<T>(minx, miny, maxx - minx, maxy - miny); } diff --git a/Runtime/Math/Vector2.h b/Runtime/Math/Vector2.h index 01fa015..62f4659 100644 --- a/Runtime/Math/Vector2.h +++ b/Runtime/Math/Vector2.h @@ -55,16 +55,16 @@ public: //inline Vector2f operator / (const Vector2f& inV, float s) { Vector2f temp(inV); temp /= s; return temp; } //inline Vector2f Inverse(const Vector2f& inVec) { return Vector2f(1.0F / inVec.x, 1.0F / inVec.y); } // -//// Normalizes a vector, asserts if the vector can be normalized +/// Normalizes a vector, asserts if the vector can be normalized //inline Vector2f Normalize(const Vector2f& inV) { return inV / Magnitude(inV); } -//// Normalizes a vector, returns default vector if it can't be normalized +/// Normalizes a vector, returns default vector if it can't be normalized //inline Vector2f NormalizeSafe(const Vector2f& inV, const Vector2f& defaultV = Vector2f::zero); // //inline Vector2f Lerp(const Vector2f& from, const Vector2f& to, float t) { return to * t + from * (1.0f - t); } // -//// Returns a vector with the smaller of every component from v0 and v1 +/// Returns a vector with the smaller of every component from v0 and v1 //inline Vector2f min(const Vector2f& lhs, const Vector2f& rhs) { return Vector2f(std::min(lhs.x, rhs.x), std::min(lhs.y, rhs.y)); } -//// Returns a vector with the larger of every component from v0 and v1 +/// Returns a vector with the larger of every component from v0 and v1 //inline Vector2f max(const Vector2f& lhs, const Vector2f& rhs) { return Vector2f(std::max(lhs.x, rhs.x), std::max(lhs.y, rhs.y)); } // //bool CompareApproximately(const Vector2f& inV0, const Vector2f& inV1, float inMaxDist = Vector2f::epsilon); @@ -79,7 +79,7 @@ public: // return CompareApproximately(SqrMagnitude(vec), 1.0F, epsilon); //} // -///// Returns the abs of every component of the vector +//// Returns the abs of every component of the vector //inline Vector2f Abs(const Vector2f& v) { return Vector2f(Abs(v.x), Abs(v.y)); } // //inline bool IsFinite(const Vector2f& f) diff --git a/Runtime/Runner.cpp b/Runtime/Runner.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Runtime/Runner.cpp diff --git a/Runtime/Runner.h b/Runtime/Runner.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Runtime/Runner.h diff --git a/Runtime/Scripting/GL.bind.cpp b/Runtime/Scripting/GL.bind.cpp new file mode 100644 index 0000000..57dba09 --- /dev/null +++ b/Runtime/Scripting/GL.bind.cpp @@ -0,0 +1,9 @@ +#include "Runtime/Graphics/OpenGL.h" +#include "Runtime/LuaBind/LuaBind.h" + +// GameLab.Engine.GL +void luaopen_GameLab_Engine_GL(lua_State* L) +{ + LUA_BIND_STATE(L); + +} |