From 850d9c034792b96e2ff5ff3bbfbcc30661757aed Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 19 Nov 2021 21:56:08 +0800 Subject: *misc --- Data/BuiltIn/Libraries/GameLab/Camera.lua | 0 .../BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua | 5 ++ Data/BuiltIn/Libraries/GameLab/Helper.lua | 26 ++++++++ Data/BuiltIn/Libraries/GameLab/StringUtil.lua | 4 ++ Data/BuiltIn/Libraries/GameLab/define.lua | 1 - Data/Libraries/GameLab/Editor/Window/GUIWindow.lua | 8 +-- Data/Scripts/EditorResources.lua | 11 ++++ Data/Scripts/defines.lua | 5 ++ Documents/Unity.xlsx | Bin 195084 -> 292645 bytes Runtime/Scripting/GL/GL.bind.cpp | 67 +++++++++++++-------- Test/README.txt | 1 + Test/lua/env.lua | 3 + 12 files changed, 100 insertions(+), 31 deletions(-) create mode 100644 Data/BuiltIn/Libraries/GameLab/Camera.lua create mode 100644 Data/BuiltIn/Libraries/GameLab/Helper.lua create mode 100644 Data/BuiltIn/Libraries/GameLab/StringUtil.lua create mode 100644 Data/Scripts/EditorResources.lua create mode 100644 Test/README.txt create mode 100644 Test/lua/env.lua diff --git a/Data/BuiltIn/Libraries/GameLab/Camera.lua b/Data/BuiltIn/Libraries/GameLab/Camera.lua new file mode 100644 index 0000000..e69de29 diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua index a16c2ed..cf84bff 100644 --- a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua +++ b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua @@ -15,6 +15,11 @@ local Rendering = GameLab.Engine.Rendering local EEventType = GameLab.Events.EEventType local Resource = GameLab.Engine.Resource +local EditorRes +if GAMELAB_EDITOR then + EditorRes = find "Scripts/EditorResources" +end + GUI.BeginOnGUI = function() GUIState.ResetControlID() end diff --git a/Data/BuiltIn/Libraries/GameLab/Helper.lua b/Data/BuiltIn/Libraries/GameLab/Helper.lua new file mode 100644 index 0000000..19b586e --- /dev/null +++ b/Data/BuiltIn/Libraries/GameLab/Helper.lua @@ -0,0 +1,26 @@ +local Helper = GameLab.GlobalClass("GameLab.Helper") + +function Helper:Ctor() + self.path = {} + self.cpath = {} +end + +function Helper:RestorePath() + local path = package.path + +end + +function Helper:RestoreCPath() + local cpath = package.cpath + +end + +function Helper:AddPath() + +end + +function Helper:AddCPath() + +end + +return Helper \ No newline at end of file diff --git a/Data/BuiltIn/Libraries/GameLab/StringUtil.lua b/Data/BuiltIn/Libraries/GameLab/StringUtil.lua new file mode 100644 index 0000000..6b1c027 --- /dev/null +++ b/Data/BuiltIn/Libraries/GameLab/StringUtil.lua @@ -0,0 +1,4 @@ +local util = Gamelab.GloablTable("GameLab.StringUtil") + + +return util \ No newline at end of file diff --git a/Data/BuiltIn/Libraries/GameLab/define.lua b/Data/BuiltIn/Libraries/GameLab/define.lua index dd4420e..ba1e130 100644 --- a/Data/BuiltIn/Libraries/GameLab/define.lua +++ b/Data/BuiltIn/Libraries/GameLab/define.lua @@ -1,4 +1,3 @@ - local define = {} define.builtInPath = "./BuiltIn" diff --git a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua index c430cfd..f1f4445 100644 --- a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua +++ b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua @@ -19,10 +19,10 @@ local clone = Utils.Clone local i = 0 local col = { - {1, 0, 0, 1}, - {1, 1, 0, 1}, - {0, 0, 1, 1}, - {0, 1, 1, 1}, + {1, 0, 0, 0.5}, + {1, 1, 0, 0.5}, + {0, 0, 1, 0.5}, + {0, 1, 1, 0.5}, } local kSideBorders = 2 -- GUIView的右边距 diff --git a/Data/Scripts/EditorResources.lua b/Data/Scripts/EditorResources.lua new file mode 100644 index 0000000..c9d2e77 --- /dev/null +++ b/Data/Scripts/EditorResources.lua @@ -0,0 +1,11 @@ +local find = GameLab.Find + +local res = {} + +local loadRes = function() + +end + +GameLab.onApplicationStart:Add(loadRes) + +return res \ No newline at end of file diff --git a/Data/Scripts/defines.lua b/Data/Scripts/defines.lua index cec592c..ec456a5 100644 --- a/Data/Scripts/defines.lua +++ b/Data/Scripts/defines.lua @@ -1,2 +1,7 @@ GAMELAB_PROFILE = true GAMELAB_DEBUG = true + +GAMELAB_EDITOR = true +GAMELAB_RUNNER = false + +GAMELAB_VERSION = "0.0.1" diff --git a/Documents/Unity.xlsx b/Documents/Unity.xlsx index 70d0a73..a2561fc 100644 Binary files a/Documents/Unity.xlsx and b/Documents/Unity.xlsx differ diff --git a/Runtime/Scripting/GL/GL.bind.cpp b/Runtime/Scripting/GL/GL.bind.cpp index f97b1e0..caf3877 100644 --- a/Runtime/Scripting/GL/GL.bind.cpp +++ b/Runtime/Scripting/GL/GL.bind.cpp @@ -175,6 +175,21 @@ int Color(lua_State* L) return 0; } +// left, bottom, width, height +int Viewport(lua_State* L) +{ + LUA_BIND_STATE(L); + + float left = state.GetValue(1, 0); + float right = state.GetValue(2, 0); + float width = state.GetValue(3, 0); + float height = state.GetValue(4, 0); + + glViewport(left, right, width, height); + + return 0; +} + int LoadIdentity(lua_State* L) { glLoadIdentity(); @@ -397,25 +412,25 @@ int Translate(lua_State* L) } static luaL_Reg glFuncs[] = { - {"ClearColor", ClearColor}, - {"Clear", Clear}, - // immediate mode apis - {"Color", Color}, - {"Begin", Begin}, - {"End", End}, - {"Vertex", Vertex }, - {"LoadIdentity", LoadIdentity}, - {"PushMatrix", PushMatrix}, - {"PopMatrix", PopMatrix}, - {"MatrixMode", MatrixMode}, - {"LoadMatrix", LoadMatrix}, - {"LoadOrthoMatrix", OrthoMatrix}, - {"LoadFrustumMatrix", FrustumMatrix}, - {"MultMatrix", MultMatrix}, - {"Scale", Scale}, - {"Rotate", Rotate}, - {"Translate", Translate}, - {0, 0} + { "ClearColor", ClearColor }, + { "Clear", Clear }, + { "Color", Color }, + { "Viewport", Viewport }, + { "Begin", Begin }, + { "End", End }, + { "Vertex", Vertex }, + { "LoadIdentity", LoadIdentity }, + { "PushMatrix", PushMatrix }, + { "PopMatrix", PopMatrix }, + { "MatrixMode", MatrixMode }, + { "LoadMatrix", LoadMatrix }, + { "LoadOrthoMatrix", OrthoMatrix }, + { "LoadFrustumMatrix", FrustumMatrix }, + { "MultMatrix", MultMatrix }, + { "Scale", Scale }, + { "Rotate", Rotate }, + { "Translate", Translate }, + { 0, 0} }; // GameLab.Engine.GL @@ -433,20 +448,20 @@ int luaopen_GameLab_Engine_GL(lua_State* L) state.RegisterMethods(glFuncs); LUA_BIND_REGISTER_ENUM(state, "EBufferType", - { "ColorBuffer", EBufferType::ColorBuffer }, - { "DepthBuffer", EBufferType::DepthBuffer}, - { "StencilBuffer", EBufferType::StencilBuffer} + { "ColorBuffer", EBufferType::ColorBuffer }, + { "DepthBuffer", EBufferType::DepthBuffer }, + { "StencilBuffer", EBufferType::StencilBuffer } ); LUA_BIND_REGISTER_ENUM(state, "EPrimitiveType", { "Triangles", EPrimitiveType::Triangles }, - { "Lines", EPrimitiveType::Lines }, - { "Points", EPrimitiveType::Points } + { "Lines", EPrimitiveType::Lines }, + { "Points", EPrimitiveType::Points } ); LUA_BIND_REGISTER_ENUM(state, "EMatrixMode", - { "MatrixView", EMatrixMode::ModelView }, - { "Projection", EMatrixMode::Projection} + { "MatrixView", EMatrixMode::ModelView }, + { "Projection", EMatrixMode::Projection } ); return 1; diff --git a/Test/README.txt b/Test/README.txt new file mode 100644 index 0000000..8409f9f --- /dev/null +++ b/Test/README.txt @@ -0,0 +1 @@ +一些测试的代码存在这个目录下 \ No newline at end of file diff --git a/Test/lua/env.lua b/Test/lua/env.lua new file mode 100644 index 0000000..9b352ec --- /dev/null +++ b/Test/lua/env.lua @@ -0,0 +1,3 @@ +-- 环境中执行代码 + + -- cgit v1.1-26-g67d0