From 922495098aea1ca569369da664dddb9780d07768 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 19 Oct 2021 19:52:29 +0800 Subject: *misc --- Documents/Lua.xlsx | Bin 0 -> 8758 bytes Editor/EditorMain.cpp | 7 ++--- Editor/Path.cpp | 0 Editor/Path.h | 0 Editor/Scripting/Editor/EditorApplication.bind.cpp | 2 +- Editor/Scripting/EditorScripting.cpp | 4 ++- Projects/VisualStudio/Editor/Editor.vcxproj | 9 ++++-- .../VisualStudio/Editor/Editor.vcxproj.filters | 20 ++++++++++--- .../Libraries/Framework/Animation/Animation.lua | 0 .../DefaultContent/Libraries/Framework/Class.lua | 3 -- .../Libraries/Framework/Core/Camera.lua | 5 ---- .../Libraries/Framework/Core/Component.lua | 11 ------- .../Libraries/Framework/Core/Game.lua | 14 --------- .../Libraries/Framework/Core/GameObject.lua | 7 ----- .../Libraries/Framework/Core/Sprite.lua | 21 -------------- .../Libraries/Framework/Math/Matrix44.lua | 7 ----- .../Libraries/Framework/Math/Quaternion.lua | 0 .../Libraries/Framework/Math/Vector2.lua | 0 .../Libraries/Framework/Math/Vector3.lua | 0 .../Libraries/Framework/Math/Vector4.lua | 0 .../Libraries/Framework/Utils/EventCenter.lua | 23 --------------- .../Libraries/Framework/Utils/StateMachine.lua | 0 .../Libraries/Framework/Utils/Util.lua | 0 .../DefaultContent/Libraries/Framework/init.lua | 2 -- .../DefaultContent/Libraries/GameLab/Class.lua | 5 ++++ .../GameLab/Engine/Animation/Animation.lua | 0 .../Libraries/GameLab/Engine/Core/Camera.lua | 5 ++++ .../Libraries/GameLab/Engine/Core/Component.lua | 11 +++++++ .../Libraries/GameLab/Engine/Core/Game.lua | 14 +++++++++ .../Libraries/GameLab/Engine/Core/GameObject.lua | 7 +++++ .../Libraries/GameLab/Engine/Core/Sprite.lua | 21 ++++++++++++++ .../Libraries/GameLab/Engine/Math/Euler.lua | 0 .../Libraries/GameLab/Engine/Math/Matrix44.lua | 7 +++++ .../Libraries/GameLab/Engine/Math/Matrix4x4.lua | 0 .../Libraries/GameLab/Engine/Math/Quaternion.lua | 4 +++ .../Libraries/GameLab/Engine/Math/Vector2.lua | 0 .../Libraries/GameLab/Engine/Math/Vector3.lua | 0 .../Libraries/GameLab/Engine/Math/Vector4.lua | 0 .../Libraries/GameLab/Engine/Math/init.lua | 4 +++ .../Libraries/GameLab/Engine/Utils/EventCenter.lua | 23 +++++++++++++++ .../GameLab/Engine/Utils/StateMachine.lua | 0 .../Libraries/GameLab/Engine/Utils/Util.lua | 0 Resources/DefaultContent/Scripts/Math/Euler.lua | 0 .../DefaultContent/Scripts/Math/Matrix4x4.lua | 0 .../DefaultContent/Scripts/Math/Quaternion.lua | 4 --- Resources/DefaultContent/Scripts/Math/Vector2.lua | 0 Resources/DefaultContent/Scripts/Math/Vector3.lua | 0 Resources/Scripts/EditorApplication.lua | 7 +++-- Resources/boot.lua | 18 ++++++++++++ Runtime/FileSystem/Path.cpp | 0 Runtime/FileSystem/Path.h | 0 Runtime/Lua/LuaBind/LuaBindState.cpp | 3 +- Runtime/Scripting/Debug/Debug.bind.cpp | 2 ++ Runtime/Scripting/FileSystem/FileSystem.bind.cpp | 10 +++++++ Runtime/Scripting/Path.bind.cpp | 32 +++++++++++++++++++++ 55 files changed, 198 insertions(+), 114 deletions(-) create mode 100644 Documents/Lua.xlsx delete mode 100644 Editor/Path.cpp delete mode 100644 Editor/Path.h delete mode 100644 Resources/DefaultContent/Libraries/Framework/Animation/Animation.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Class.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Core/Camera.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Core/Component.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Core/Game.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Math/Quaternion.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Math/Vector2.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Math/Vector3.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Math/Vector4.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Utils/StateMachine.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/Utils/Util.lua delete mode 100644 Resources/DefaultContent/Libraries/Framework/init.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Class.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Animation/Animation.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Core/Camera.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Core/Component.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Core/Game.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Core/GameObject.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Core/Sprite.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Euler.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Quaternion.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Math/init.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Utils/EventCenter.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Utils/StateMachine.lua create mode 100644 Resources/DefaultContent/Libraries/GameLab/Engine/Utils/Util.lua delete mode 100644 Resources/DefaultContent/Scripts/Math/Euler.lua delete mode 100644 Resources/DefaultContent/Scripts/Math/Matrix4x4.lua delete mode 100644 Resources/DefaultContent/Scripts/Math/Quaternion.lua delete mode 100644 Resources/DefaultContent/Scripts/Math/Vector2.lua delete mode 100644 Resources/DefaultContent/Scripts/Math/Vector3.lua create mode 100644 Resources/boot.lua create mode 100644 Runtime/FileSystem/Path.cpp create mode 100644 Runtime/FileSystem/Path.h create mode 100644 Runtime/Scripting/FileSystem/FileSystem.bind.cpp create mode 100644 Runtime/Scripting/Path.bind.cpp diff --git a/Documents/Lua.xlsx b/Documents/Lua.xlsx new file mode 100644 index 0000000..33d6bec Binary files /dev/null and b/Documents/Lua.xlsx differ diff --git a/Editor/EditorMain.cpp b/Editor/EditorMain.cpp index 88f7513..182a2c4 100644 --- a/Editor/EditorMain.cpp +++ b/Editor/EditorMain.cpp @@ -31,11 +31,8 @@ void InitLuaState() std::string workingDir = Win::GetCurrentWorkingDirectory(); Win::SetDllSearchDirectory(workingDir); - // set search path - state.DoString(R"(package.path=package.path .. ";" .. ".\\Libraries\\?.lua")"); - state.DoString(R"(package.cpath=package.cpath .. ";" .. ".\\Libraries\\?.dll")"); - - state.DoFile(".\\Scripts\\EditorApplication.lua", ErrorHandle); + state.DoFile("./boot.lua", ErrorHandle); + state.DoFile("./Scripts/EditorApplication.lua", ErrorHandle); } #ifdef GAMELAB_DEBUG diff --git a/Editor/Path.cpp b/Editor/Path.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/Editor/Path.h b/Editor/Path.h deleted file mode 100644 index e69de29..0000000 diff --git a/Editor/Scripting/Editor/EditorApplication.bind.cpp b/Editor/Scripting/Editor/EditorApplication.bind.cpp index 33d73f7..184870a 100644 --- a/Editor/Scripting/Editor/EditorApplication.bind.cpp +++ b/Editor/Scripting/Editor/EditorApplication.bind.cpp @@ -3,7 +3,7 @@ LUA_BIND_REGISTRY(EditorApplication) { LUA_BIND_REGISTER_METHODS(state, - {"New", EditorApplication::_New}, + { "New", _New}, { "SetMainWindow", _SetMainWindow }, { "PullMessage", _PullMessage } ); diff --git a/Editor/Scripting/EditorScripting.cpp b/Editor/Scripting/EditorScripting.cpp index bb53848..26509e0 100644 --- a/Editor/Scripting/EditorScripting.cpp +++ b/Editor/Scripting/EditorScripting.cpp @@ -3,6 +3,7 @@ extern int luaopen_GameLab_Debug(lua_State* L); // GameLab.Debug extern int luaopen_GameLab_IO(lua_State* L); // GameLab.IO +extern int luaopen_GameLab_Path(lua_State* L); // GameLab.Path extern int luaopen_GameLab_Engine(lua_State* L); // GameLab.Engine extern int luaopen_GameLab_Engine_Rendering(lua_State* L); // GameLab.Engine.Rendering @@ -31,7 +32,8 @@ bool SetupGameLabEditorScripting(lua_State* L) { log_info("Scripting", "SetupGameLabEditorScripting()"); - openlib(luaopen_GameLab_Debug); + openlib(luaopen_GameLab_Debug); + openlib(luaopen_GameLab_Path); openlib(luaopen_GameLab_Editor); openlib(luaopen_GameLab_Editor_GUI); diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj b/Projects/VisualStudio/Editor/Editor.vcxproj index ab1a930..8d8afbe 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj +++ b/Projects/VisualStudio/Editor/Editor.vcxproj @@ -87,7 +87,7 @@ Disabled true true - _CRT_SECURE_NO_WARNINGS;GAMELAB_DEBUG;GAMELAB_EDITOR;%(PreprocessorDefinitions) + GAMELAB_WIN;_CRT_SECURE_NO_WARNINGS;GAMELAB_DEBUG;%(PreprocessorDefinitions) $(SolutionDir)..\..\;$(SolutionDir)..\..\ThirdParty\;%(AdditionalIncludeDirectories) @@ -134,6 +134,7 @@ true true $(SolutionDir)..\..\;%(AdditionalIncludeDirectories) + GAMELAB_WIN;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Windows @@ -156,7 +157,6 @@ - @@ -170,6 +170,7 @@ + @@ -184,7 +185,9 @@ + + @@ -197,13 +200,13 @@ - + diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj.filters b/Projects/VisualStudio/Editor/Editor.vcxproj.filters index fd17b7d..8ee4621 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj.filters +++ b/Projects/VisualStudio/Editor/Editor.vcxproj.filters @@ -79,6 +79,12 @@ {34aaae68-c302-4827-917f-671b0279e8c6} + + {78c0524a-9039-474a-9a2e-fa243e84d60e} + + + {350338b7-1176-4edc-9cc7-553a02d69895} + @@ -213,8 +219,14 @@ Editor\Win - - Editor + + Runtime\FileSystem + + + Runtime\Scripting\FileSystem + + + Runtime\Scripting @@ -350,8 +362,8 @@ Editor\Win - - Editor + + Runtime\FileSystem diff --git a/Resources/DefaultContent/Libraries/Framework/Animation/Animation.lua b/Resources/DefaultContent/Libraries/Framework/Animation/Animation.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/Class.lua b/Resources/DefaultContent/Libraries/Framework/Class.lua deleted file mode 100644 index 78c577c..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Class.lua +++ /dev/null @@ -1,3 +0,0 @@ -function Class() - -end \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Core/Camera.lua b/Resources/DefaultContent/Libraries/Framework/Core/Camera.lua deleted file mode 100644 index 5fcfbe7..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Core/Camera.lua +++ /dev/null @@ -1,5 +0,0 @@ -local Camera = {} - - - -return Camera \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Core/Component.lua b/Resources/DefaultContent/Libraries/Framework/Core/Component.lua deleted file mode 100644 index 00bf2ca..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Core/Component.lua +++ /dev/null @@ -1,11 +0,0 @@ -local Component = {} - -Component.New = function() - -end - -Component.GetGameObject = function() - -end - -Jin.Component = Component \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Core/Game.lua b/Resources/DefaultContent/Libraries/Framework/Core/Game.lua deleted file mode 100644 index 51ce25f..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Core/Game.lua +++ /dev/null @@ -1,14 +0,0 @@ - --- Game entry - -local Game = {} - -Game.OnEvent = function(e) - -end - -Game.MainLoop = function() - -end - -return Game \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua b/Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua deleted file mode 100644 index ee0d143..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Core/GameObject.lua +++ /dev/null @@ -1,7 +0,0 @@ -local GameObject = {} - -GameObject.AddComponent = function(self, comp) - -end - -Jin.GameObject = GameObject diff --git a/Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua b/Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua deleted file mode 100644 index 47cb50d..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Core/Sprite.lua +++ /dev/null @@ -1,21 +0,0 @@ --- 对Quad的封装,更能适合2D游戏开发 -local Sprite = {} - -Sprite.New = function(quad) - local spr = {} - spr.quad = Jin.Quad.New(quad) - spr.pivot = Jin.Vector2.New(0.5, 0) - spr.transform = Jin.Transform.New() - spr.depth = 0 - return spr -end - -Sprite.SetDepth = function(self, depth) - spr.depth = depth -end - -Sprite.SetTexture = function(self, tex, reset_quad) - -end - -Jin.Sprite = Sprite \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua b/Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua deleted file mode 100644 index b572f74..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Math/Matrix44.lua +++ /dev/null @@ -1,7 +0,0 @@ -local Matrix44 = {} - -Matrix44.New = function() - -end - -return Matrix44 \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Math/Quaternion.lua b/Resources/DefaultContent/Libraries/Framework/Math/Quaternion.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/Math/Vector2.lua b/Resources/DefaultContent/Libraries/Framework/Math/Vector2.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/Math/Vector3.lua b/Resources/DefaultContent/Libraries/Framework/Math/Vector3.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/Math/Vector4.lua b/Resources/DefaultContent/Libraries/Framework/Math/Vector4.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua b/Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua deleted file mode 100644 index 664ecba..0000000 --- a/Resources/DefaultContent/Libraries/Framework/Utils/EventCenter.lua +++ /dev/null @@ -1,23 +0,0 @@ -local EventCenter = {} - -EventCenter.Subscribe = function(event, callback) - -end - -EventCenter.Unsubscribe = function(event, callback) - -end - -EventCenter.UnsubscribeAll = function(event) - -end - -EventCenter.Publish = function(event, ...) - -end - -EventCenter.Clear = function() - -end - -Jin.EventCenter = EventCenter \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/Framework/Utils/StateMachine.lua b/Resources/DefaultContent/Libraries/Framework/Utils/StateMachine.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/Utils/Util.lua b/Resources/DefaultContent/Libraries/Framework/Utils/Util.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Libraries/Framework/init.lua b/Resources/DefaultContent/Libraries/Framework/init.lua deleted file mode 100644 index 8b96176..0000000 --- a/Resources/DefaultContent/Libraries/Framework/init.lua +++ /dev/null @@ -1,2 +0,0 @@ ---Jin游戏框架 ---可选,用户可以自行决定是否使用此框架 diff --git a/Resources/DefaultContent/Libraries/GameLab/Class.lua b/Resources/DefaultContent/Libraries/GameLab/Class.lua new file mode 100644 index 0000000..346d807 --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Class.lua @@ -0,0 +1,5 @@ +-- GameLab Class +local Class = {} +GameLab.Class = Class + + diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Animation/Animation.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Animation/Animation.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Camera.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Camera.lua new file mode 100644 index 0000000..5fcfbe7 --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Camera.lua @@ -0,0 +1,5 @@ +local Camera = {} + + + +return Camera \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Component.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Component.lua new file mode 100644 index 0000000..00bf2ca --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Component.lua @@ -0,0 +1,11 @@ +local Component = {} + +Component.New = function() + +end + +Component.GetGameObject = function() + +end + +Jin.Component = Component \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Game.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Game.lua new file mode 100644 index 0000000..51ce25f --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Game.lua @@ -0,0 +1,14 @@ + +-- Game entry + +local Game = {} + +Game.OnEvent = function(e) + +end + +Game.MainLoop = function() + +end + +return Game \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Core/GameObject.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/GameObject.lua new file mode 100644 index 0000000..ee0d143 --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/GameObject.lua @@ -0,0 +1,7 @@ +local GameObject = {} + +GameObject.AddComponent = function(self, comp) + +end + +Jin.GameObject = GameObject diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Sprite.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Sprite.lua new file mode 100644 index 0000000..47cb50d --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Core/Sprite.lua @@ -0,0 +1,21 @@ +-- 对Quad的封装,更能适合2D游戏开发 +local Sprite = {} + +Sprite.New = function(quad) + local spr = {} + spr.quad = Jin.Quad.New(quad) + spr.pivot = Jin.Vector2.New(0.5, 0) + spr.transform = Jin.Transform.New() + spr.depth = 0 + return spr +end + +Sprite.SetDepth = function(self, depth) + spr.depth = depth +end + +Sprite.SetTexture = function(self, tex, reset_quad) + +end + +Jin.Sprite = Sprite \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Euler.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Euler.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua new file mode 100644 index 0000000..b572f74 --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua @@ -0,0 +1,7 @@ +local Matrix44 = {} + +Matrix44.New = function() + +end + +return Matrix44 \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Quaternion.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Quaternion.lua new file mode 100644 index 0000000..4c71f52 --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Quaternion.lua @@ -0,0 +1,4 @@ +local Quaternion = {} + +return Quaternion + diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/init.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/init.lua new file mode 100644 index 0000000..ef33c08 --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/init.lua @@ -0,0 +1,4 @@ +GameLab = GameLab or {} +GameLab.Math = GameLab.Math or {} + + diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/EventCenter.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/EventCenter.lua new file mode 100644 index 0000000..664ecba --- /dev/null +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/EventCenter.lua @@ -0,0 +1,23 @@ +local EventCenter = {} + +EventCenter.Subscribe = function(event, callback) + +end + +EventCenter.Unsubscribe = function(event, callback) + +end + +EventCenter.UnsubscribeAll = function(event) + +end + +EventCenter.Publish = function(event, ...) + +end + +EventCenter.Clear = function() + +end + +Jin.EventCenter = EventCenter \ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/StateMachine.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/StateMachine.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/Util.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Utils/Util.lua new file mode 100644 index 0000000..e69de29 diff --git a/Resources/DefaultContent/Scripts/Math/Euler.lua b/Resources/DefaultContent/Scripts/Math/Euler.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Scripts/Math/Matrix4x4.lua b/Resources/DefaultContent/Scripts/Math/Matrix4x4.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Scripts/Math/Quaternion.lua b/Resources/DefaultContent/Scripts/Math/Quaternion.lua deleted file mode 100644 index 4c71f52..0000000 --- a/Resources/DefaultContent/Scripts/Math/Quaternion.lua +++ /dev/null @@ -1,4 +0,0 @@ -local Quaternion = {} - -return Quaternion - diff --git a/Resources/DefaultContent/Scripts/Math/Vector2.lua b/Resources/DefaultContent/Scripts/Math/Vector2.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/DefaultContent/Scripts/Math/Vector3.lua b/Resources/DefaultContent/Scripts/Math/Vector3.lua deleted file mode 100644 index e69de29..0000000 diff --git a/Resources/Scripts/EditorApplication.lua b/Resources/Scripts/EditorApplication.lua index d7beb3c..a01778d 100644 --- a/Resources/Scripts/EditorApplication.lua +++ b/Resources/Scripts/EditorApplication.lua @@ -1,4 +1,5 @@ -require("LuaPanda").start("127.0.0.1",8818); + +require "GameLab.Engine.Math" local Debug = GameLab.Debug local GUI = GameLab.Editor.GUI @@ -19,7 +20,9 @@ local guiWindow = GUI.GUIWindow.New() guiWindow:SetContainnerWindow(mainWindow) guiWindow:SetPosition({0,0, 500, 400}) -Debug.Log(package.cpath) + +Debug.Log(GameLab.Path.GetRootDirectory()) + while true do diff --git a/Resources/boot.lua b/Resources/boot.lua new file mode 100644 index 0000000..66cc78f --- /dev/null +++ b/Resources/boot.lua @@ -0,0 +1,18 @@ + +-- 妯″潡鎼滅储鐩綍 +local engineLuaLibs = "./DefaultContent/Libraries/?.lua" .. ";./DefaultContent/Libraries/?/init.lua" +local editorLuaLibs = "./Libraries/?.lua" .. ";./Libraries/?/init.lua" +local editorScripts = "./Scripts/?.lua" +package.path=package.path .. ";" .. editorScripts .. ";" .. engineLuaLibs .. ";" .. editorLuaLibs + +local engineCLibs = "./DefaultContent/Libraries/?.dll" +local editorCLibs = "./Libraries/?.dll" +package.cpath=package.cpath .. ";" .. engineCLibs .. ";" .. editorCLibs + + +-- redirect +print = GameLab.Debug.Log + + + +require("LuaPanda").start("127.0.0.1",8818); diff --git a/Runtime/FileSystem/Path.cpp b/Runtime/FileSystem/Path.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Runtime/FileSystem/Path.h b/Runtime/FileSystem/Path.h new file mode 100644 index 0000000..e69de29 diff --git a/Runtime/Lua/LuaBind/LuaBindState.cpp b/Runtime/Lua/LuaBind/LuaBindState.cpp index 8b6a5aa..fa2952f 100644 --- a/Runtime/Lua/LuaBind/LuaBindState.cpp +++ b/Runtime/Lua/LuaBind/LuaBindState.cpp @@ -164,7 +164,8 @@ namespace LuaBind } if (lua_pcall(mState, nArgs, nResults, func) == 0) { - lua_remove(mState, func); + if(func != 0) + lua_remove(mState, func); } else { diff --git a/Runtime/Scripting/Debug/Debug.bind.cpp b/Runtime/Scripting/Debug/Debug.bind.cpp index 6d37746..9d98211 100644 --- a/Runtime/Scripting/Debug/Debug.bind.cpp +++ b/Runtime/Scripting/Debug/Debug.bind.cpp @@ -88,6 +88,8 @@ int logEditor(lua_State* L) log_error("Debug.Log()错误的参数个数"); } return 0; +#else + return 0; #endif } diff --git a/Runtime/Scripting/FileSystem/FileSystem.bind.cpp b/Runtime/Scripting/FileSystem/FileSystem.bind.cpp new file mode 100644 index 0000000..fea8b57 --- /dev/null +++ b/Runtime/Scripting/FileSystem/FileSystem.bind.cpp @@ -0,0 +1,10 @@ +#include + +#include "Runtime/Lua/LuaBind/LuaBind.h" + +int luaopen_GameLab_FileSystem(lua_State* L) +{ + + return 1; +} + diff --git a/Runtime/Scripting/Path.bind.cpp b/Runtime/Scripting/Path.bind.cpp new file mode 100644 index 0000000..920f586 --- /dev/null +++ b/Runtime/Scripting/Path.bind.cpp @@ -0,0 +1,32 @@ +#include "Runtime/Lua/LuaBind/LuaBind.h" + +#ifdef GAMELAB_WIN +#include +#endif + +using namespace LuaBind; + +static int GetRootDirectory(lua_State* L) +{ +#ifdef GAMELAB_WIN + char path[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, path); + lua_pushstring(L, path); + return 1; +#else + return 0; +#endif +} + +int luaopen_GameLab_Path(lua_State* L) +{ + LUA_BIND_STATE(L); + + state.PushGlobalNamespace(); + state.PushNamespace("GameLab"); + state.PushNamespace("Path"); + + state.RegisterMethod("GetRootDirectory", GetRootDirectory); + + return 1; +} -- cgit v1.1-26-g67d0