From 138d3f4d3d6e2aaf5ba34f89af15ef85ea074357 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Nov 2021 09:23:38 +0800 Subject: *misc --- .../Libraries/GameLab/Engine/Math/Matrix33.lua | 2 +- .../Libraries/GameLab/Engine/Math/Matrix44.lua | 2 +- .../Libraries/GameLab/Engine/Math/Rect.lua | 9 +++- .../Libraries/GameLab/Engine/Math/Vector2.lua | 2 +- .../Libraries/GameLab/Engine/Math/Vector3.lua | 2 +- .../Libraries/GameLab/Engine/Math/Vector4.lua | 2 +- .../Libraries/GameLab/Engine/Math/init.lua | 13 +++--- .../Libraries/GameLab/Engine/Rendering/Color.lua | 2 +- .../Libraries/GameLab/Engine/Rendering/Color32.lua | 2 +- .../Libraries/GameLab/Engine/Rendering/Image.lua | 2 +- .../GameLab/Engine/Rendering/Material.lua | 2 +- .../GameLab/Engine/Resource/ImageDataRequest.lua | 2 +- Data/DefaultContent/Libraries/GameLab/Entity.lua | 6 --- Data/DefaultContent/Libraries/GameLab/Enum.lua | 22 +++++++-- .../Libraries/GameLab/GlobalClass.lua | 20 ++++++++ .../Libraries/GameLab/GlobalEnum.lua | 20 ++++++++ .../Libraries/GameLab/InternalClass.lua | 12 ----- Data/DefaultContent/Libraries/GameLab/Node.lua | 7 +++ Data/DefaultContent/Libraries/GameLab/Object.lua | 5 -- Data/DefaultContent/Libraries/GameLab/init.lua | 15 ++---- Data/Libraries/GameLab/Editor/EditorWindow.lua | 2 +- .../GameLab/Editor/GUI/ContainerWindow.lua | 20 ++++++++ Data/Libraries/GameLab/Editor/GUI/GUIWindow.lua | 51 ++++++++++++++++++++- Data/Libraries/GameLab/Editor/GUI/SplitWindow.lua | 14 ++++++ Data/Libraries/GameLab/Editor/GUI/init.lua | 3 ++ Data/Resources/Metatable/Excel/Icons.xlsx | Bin 12447 -> 12445 bytes Data/Scripts/Editor/AssetBrowser.lua | 2 +- Data/Scripts/EditorApplication.lua | 47 +++---------------- Data/Scripts/macro.lua | 3 ++ Data/Scripts/settings.lua | 9 ++++ Data/boot.lua | 5 +- Data/macro.lua | 3 -- 32 files changed, 203 insertions(+), 105 deletions(-) delete mode 100644 Data/DefaultContent/Libraries/GameLab/Entity.lua create mode 100644 Data/DefaultContent/Libraries/GameLab/GlobalClass.lua create mode 100644 Data/DefaultContent/Libraries/GameLab/GlobalEnum.lua delete mode 100644 Data/DefaultContent/Libraries/GameLab/InternalClass.lua create mode 100644 Data/DefaultContent/Libraries/GameLab/Node.lua delete mode 100644 Data/DefaultContent/Libraries/GameLab/Object.lua create mode 100644 Data/Libraries/GameLab/Editor/GUI/ContainerWindow.lua create mode 100644 Data/Libraries/GameLab/Editor/GUI/SplitWindow.lua create mode 100644 Data/Scripts/macro.lua create mode 100644 Data/Scripts/settings.lua delete mode 100644 Data/macro.lua (limited to 'Data') diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix33.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix33.lua index 8cb7e72..ec263d0 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix33.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix33.lua @@ -1,4 +1,4 @@ -local Matrix33 = GameLab.Class("GameLab.Engine.Math.Matrix33") +local Matrix33 = GameLab.GlobalClass("GameLab.Engine.Math.Matrix33") Matrix33.Ctor = function(self) diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua index 2347207..9386daf 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Matrix44.lua @@ -1,4 +1,4 @@ -local Matrix44 = GameLab.Class("GameLab.Engine.Math.Matrix44") +local Matrix44 = GameLab.GlobalClass("GameLab.Engine.Math.Matrix44") Matrix44.Ctor = function(self) for r = 0, 3 do diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Rect.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Rect.lua index 2aeb0f7..f603ed5 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Rect.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Rect.lua @@ -1,4 +1,4 @@ -local Rect = GameLab.Class("GameLab.Engine.Math.Rect") +local Rect = GameLab.GlobalClass("GameLab.Engine.Math.Rect") Rect.Ctor = function(self, x, y, width, height) self.x = x or 0 @@ -7,4 +7,11 @@ Rect.Ctor = function(self, x, y, width, height) self.height = height or 0 end +Rect.Set = function(self, rect) + self.x = rect.x or rect[1] + self.y = rect.y or rect[2] + self.z = rect.z or rect[3] + self.w = rect.w or rect[4] +end + return Rect \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua index 822537f..9a0e0a3 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua @@ -1,4 +1,4 @@ -local Vector2 = GameLab.Class("GameLab.Engine.Math.Vector2") +local Vector2 = GameLab.GlobalClass("GameLab.Engine.Math.Vector2") Vector2.Ctor = function(self, x, y) self.x = x or 0 diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua index e383bf0..8203b1f 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua @@ -1,4 +1,4 @@ -local Vector3 = GameLab.Class("GameLab.Engine.Math.Vector3") +local Vector3 = GameLab.GlobalClass("GameLab.Engine.Math.Vector3") Vector3.Ctor = function(self, x, y, z) self.x = x or 0 diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua index e232c93..3655184 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua @@ -1,4 +1,4 @@ -local Vector4 = GameLab.Class("GameLab.Engine.Math.Vector4") +local Vector4 = GameLab.GlobalClass("GameLab.Engine.Math.Vector4") Vector4.Ctor = function (self, x, y, z, w) self.x = x or 0 diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Math/init.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Math/init.lua index eb75db7..5131b07 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Math/init.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Math/init.lua @@ -4,12 +4,13 @@ GameLab.Engine.Math = m local import = GameLab.import(...) import("Math") -m.Vector2 = import("Vector2") -m.Vector3 = import("Vector3") -m.Vector4 = import("Vector4") -m.Matrix44 = import("Matrix44") -m.Matrix33 = import("Matrix33") -m.Quaternion = import("Quaternion") +import("Vector2") +import("Vector3") +import("Vector4") +import("Matrix44") +import("Matrix33") +import("Quaternion") +import("Rect") GameLab.Debug.Log("GameLab.Engine.Math loaded") diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua index bf908a4..2785bdf 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua @@ -1,4 +1,4 @@ -local Color = GameLab.Class("GameLab.Engine.Rendering.Color") +local Color = GameLab.GlobalClass("GameLab.Engine.Rendering.Color") Color.Ctor = function(self, r, g, b, a) self.r = r diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua index d108dfb..48902b6 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua @@ -1,4 +1,4 @@ -local Color32 = GameLab.Class("GameLab.Engine.Rendering.Color32") +local Color32 = GameLab.GlobalClass("GameLab.Engine.Rendering.Color32") Color32.Ctor = function(self, r, g, b, a) self.r = r diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Image.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Image.lua index b209425..5ef75e5 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Image.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Image.lua @@ -1,5 +1,5 @@ -- Image在texture基础上增加了一些元数据 -local Image = GameLab.Class("GameLab.Engine.Rendering.Image") +local Image = GameLab.GlobalClass("GameLab.Engine.Rendering.Image") Image.Ctor = function(self, texture) self.texture = texture -- "atlas" diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Material.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Material.lua index 872d7e1..7993f33 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Material.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Rendering/Material.lua @@ -1,4 +1,4 @@ -local Material = GameLab.Class("GameLab.Engine.Rendering.Material") +local Material = GameLab.GlobalClass("GameLab.Engine.Rendering.Material") Material.Ctor = function(self) self.shader = nil -- 绑定的shader diff --git a/Data/DefaultContent/Libraries/GameLab/Engine/Resource/ImageDataRequest.lua b/Data/DefaultContent/Libraries/GameLab/Engine/Resource/ImageDataRequest.lua index f7d7bbe..c35d35a 100644 --- a/Data/DefaultContent/Libraries/GameLab/Engine/Resource/ImageDataRequest.lua +++ b/Data/DefaultContent/Libraries/GameLab/Engine/Resource/ImageDataRequest.lua @@ -1,4 +1,4 @@ -local ImageDataRequest = GameLab.Class("GameLab.Engine.Resource.ImageDataRequest") +local ImageDataRequest = GameLab.GlobalClass("GameLab.Engine.Resource.ImageDataRequest") ImageDataRequest.Ctor = function(self) self.isDone = false diff --git a/Data/DefaultContent/Libraries/GameLab/Entity.lua b/Data/DefaultContent/Libraries/GameLab/Entity.lua deleted file mode 100644 index 27769f3..0000000 --- a/Data/DefaultContent/Libraries/GameLab/Entity.lua +++ /dev/null @@ -1,6 +0,0 @@ --- 游戏中的实体 -local Entity = GameLab.Class("GameLab.Entity") - - - -return Entity \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/Enum.lua b/Data/DefaultContent/Libraries/GameLab/Enum.lua index d1a1ae0..1db5e89 100644 --- a/Data/DefaultContent/Libraries/GameLab/Enum.lua +++ b/Data/DefaultContent/Libraries/GameLab/Enum.lua @@ -1,9 +1,25 @@ -- Declare enum +local Debug = GameLab.Debug -local Enum = function() +local unmodified = { + __newindex = function(t, k, val) + Debug.LogError("Enum is readonly. key=" .. k) + end, + __index = function(t, k, val) + Debug.LogError("Invalid key " .. k) + end +} -end +local Enum = function(tb) + local enum = {} + for i, v in ipairs(tb) do + enum[v] = i + end + setmetatable(enum, unmodified) + return enum +end +GameLab.Enum = Enum -GameLab.Enum = Enum \ No newline at end of file +return Enum diff --git a/Data/DefaultContent/Libraries/GameLab/GlobalClass.lua b/Data/DefaultContent/Libraries/GameLab/GlobalClass.lua new file mode 100644 index 0000000..dcb5fba --- /dev/null +++ b/Data/DefaultContent/Libraries/GameLab/GlobalClass.lua @@ -0,0 +1,20 @@ +local Class = GameLab.Class or require("GameLab.Class") + +-- 声明类的同时添加到G表 +local GlobalClass = function(className) + local cls = Class(className) + + local shortName = string.match(className, "%.*(%w+)$") + local t = _G + for pkg in string.gmatch(className, "%.*(%w+)%.") do + t[pkg] = t[pkg] or {} + t = t[pkg] + end + t[shortName] = cls + + return cls +end + +GameLab.GlobalClass = GlobalClass + +return GlobalClass \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/GlobalEnum.lua b/Data/DefaultContent/Libraries/GameLab/GlobalEnum.lua new file mode 100644 index 0000000..4a160fa --- /dev/null +++ b/Data/DefaultContent/Libraries/GameLab/GlobalEnum.lua @@ -0,0 +1,20 @@ +local Enum = GameLab.Enum or require("GameLab.Enum") + +-- 声明类的同时添加到G表 +local GlobalEnum = function(enumName) + local enum = Enum(enumName) + + local shortName = string.match(enumName, "%.*(%w+)$") + local t = _G + for pkg in string.gmatch(enumName, "%.*(%w+)%.") do + t[pkg] = t[pkg] or {} + t = t[pkg] + end + t[shortName] = enum + + return enum +end + +GameLab.GlobalEnum = GlobalEnum + +return GlobalEnum \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/InternalClass.lua b/Data/DefaultContent/Libraries/GameLab/InternalClass.lua deleted file mode 100644 index 36ad568..0000000 --- a/Data/DefaultContent/Libraries/GameLab/InternalClass.lua +++ /dev/null @@ -1,12 +0,0 @@ -local Class = GameLab.Class or require("GameLab.Class") - --- 声明类的同时添加到G表 -local InternalClass = function(className) - local cls = Class(className) - _G[className] = className - return cls -end - -GameLab.InternalClass = InternalClass - -return InternalClass \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/Node.lua b/Data/DefaultContent/Libraries/GameLab/Node.lua new file mode 100644 index 0000000..c5d43e9 --- /dev/null +++ b/Data/DefaultContent/Libraries/GameLab/Node.lua @@ -0,0 +1,7 @@ +--https://stackoverflow.com/questions/27897714/whats-the-distinction-between-an-entity-and-a-game-object +-- 游戏中的实体 +local Node = GameLab.GlobalClass("GameLab.Node") + + + +return Node \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/Object.lua b/Data/DefaultContent/Libraries/GameLab/Object.lua deleted file mode 100644 index 94d4154..0000000 --- a/Data/DefaultContent/Libraries/GameLab/Object.lua +++ /dev/null @@ -1,5 +0,0 @@ -local Object = GameLab.Class("GameLab.Object") - - - -return Object \ No newline at end of file diff --git a/Data/DefaultContent/Libraries/GameLab/init.lua b/Data/DefaultContent/Libraries/GameLab/init.lua index c87ace3..8f61b05 100644 --- a/Data/DefaultContent/Libraries/GameLab/init.lua +++ b/Data/DefaultContent/Libraries/GameLab/init.lua @@ -12,17 +12,6 @@ GameLab.import = function(packageName) return _import end --- 用于相对路径包含 --- GameLab.require = function(className) --- local packageName = (type(className) == "string") and string.match(className, "^(.+)%.%w+$") or "" --- local _require = function(path) --- local name = packageName .. "." .. path --- local m = require(name) --- return m --- end --- return _require --- end - GameLab.find = function(fullName) if _G[fullName] ~= nil then return _G[fullName] @@ -35,7 +24,9 @@ end -- classes GameLab.Class = require("GameLab.Class") +GameLab.GlobalClass = require("GameLab.GlobalClass") -GameLab.InternalClass = require("GameLab.InternalClass") +GameLab.Enum = require("GameLab.Enum") +GameLab.GlobalEnum = require("GameLab.GlobalEnum") return GameLab \ No newline at end of file diff --git a/Data/Libraries/GameLab/Editor/EditorWindow.lua b/Data/Libraries/GameLab/Editor/EditorWindow.lua index d765031..6bb59d3 100644 --- a/Data/Libraries/GameLab/Editor/EditorWindow.lua +++ b/Data/Libraries/GameLab/Editor/EditorWindow.lua @@ -4,7 +4,7 @@ -- |- GUIWindow -- |- EditorWindow -local EditorWindow = GameLab.Class("GameLab.Editor.EditorWindow") +local EditorWindow = GameLab.GlobalClass("GameLab.Editor.EditorWindow") EditorWindow.Ctor = function(self, title) self.title = title -- 编辑器名称 diff --git a/Data/Libraries/GameLab/Editor/GUI/ContainerWindow.lua b/Data/Libraries/GameLab/Editor/GUI/ContainerWindow.lua new file mode 100644 index 0000000..af525f0 --- /dev/null +++ b/Data/Libraries/GameLab/Editor/GUI/ContainerWindow.lua @@ -0,0 +1,20 @@ +local InternalContainWidow = GameLab.Editor.GUI.Internal.ContainerWindow +local ContainerWindow = GameLab.GlobalClass("GameLab.Editor.GUI.ContainerWindow") + +ContainerWindow.Ctor = function(self, position, showMode, min, max) + self.m_Internal = InternalContainWidow.New(position, showMode, min, max) +end + +ContainerWindow.SetTitle = function(self) + self.m_Internal:SetTitle(self) +end + +ContainerWindow.SetIcon = function(self) + self.m_Internal:SetIcon(self) +end + +ContainerWindow.GetInternal = function(self) + return self.m_Internal +end + +return ContainerWindow \ No newline at end of file diff --git a/Data/Libraries/GameLab/Editor/GUI/GUIWindow.lua b/Data/Libraries/GameLab/Editor/GUI/GUIWindow.lua index 275c2a7..e283c07 100644 --- a/Data/Libraries/GameLab/Editor/GUI/GUIWindow.lua +++ b/Data/Libraries/GameLab/Editor/GUI/GUIWindow.lua @@ -1,5 +1,52 @@ -local GUIWindowScript = {} +local InternalGUIWindow = GameLab.Editor.GUI.Internal.GUIWindow +local GUIWindow = GameLab.GlobalClass("GameLab.Editor.GUI.GUIWindow") +local Debug = GameLab.Debug +local GL = GameLab.Engine.GL +local Math = GameLab.Engine.Math +local Rendering = GameLab.Engine.Rendering +local Rect = Math.Rect -return GUIWindowScript \ No newline at end of file +GUIWindow.Ctor = function(self) + self.m_Internal = InternalGUIWindow.New(self) + self.m_ContainerWindow = nil + self.m_SplitWindow = nil + self.m_Position = Rect.New(0,0,0,0) -- 在父窗口中的位置和大小 + self.m_EditorWindows = {} -- 编辑器脚本 +end + +GUIWindow.SetContainerWindow = function(self, containerWindow) + self.m_ContainerWindow = containerWindow + self.m_Internal:SetContainerWindow(containerWindow:GetInternal()) +end + +GUIWindow.SetPosition = function(self, pos) + self.m_Position:Set(pos) + self.m_Internal:SetPosition(pos) +end + +GUIWindow.GetInternal = function(self) + return self.m_Internal +end + +GUIWindow.OnGUI = function(self) + self:ClearBackground() + +end + +GUIWindow.GetContainerWindow = function(self) + return self.m_ContainerWindow +end + +GUIWindow.OnFocus = function(self) + Debug.Log("GUIWindow.OnFocus") +end + +GUIWindow.ClearBackground = function(self) + GL.ClearColor({1,0,0,1}) + GL.Clear(GL.EBufferType.ColorBuffer) + +end + +return GUIWindow \ No newline at end of file diff --git a/Data/Libraries/GameLab/Editor/GUI/SplitWindow.lua b/Data/Libraries/GameLab/Editor/GUI/SplitWindow.lua new file mode 100644 index 0000000..0d6417e --- /dev/null +++ b/Data/Libraries/GameLab/Editor/GUI/SplitWindow.lua @@ -0,0 +1,14 @@ +local SplitWindow = GameLab.GlobalClass("GameLab.Editor.GUI.SplitWindow") + +local ESplitMode = GameLab.GlobalEnum("GameLab.Editor.GUI.ESplitMode", { + "Vertical", + "Horizontal" +}) + +SplitWindow.Ctor = function(self) + self.m_Splitter = {} + self.m_SplitMode = ESplitMode.Horizontal + self.m_GUIWindows = {} +end + +return SplitWindow \ No newline at end of file diff --git a/Data/Libraries/GameLab/Editor/GUI/init.lua b/Data/Libraries/GameLab/Editor/GUI/init.lua index 8e9b899..5507a16 100644 --- a/Data/Libraries/GameLab/Editor/GUI/init.lua +++ b/Data/Libraries/GameLab/Editor/GUI/init.lua @@ -3,4 +3,7 @@ local m = GameLab.Editor.GUI local import = GameLab.import(...) +import("ContainerWindow") +import("GUIWindow") + return m \ No newline at end of file diff --git a/Data/Resources/Metatable/Excel/Icons.xlsx b/Data/Resources/Metatable/Excel/Icons.xlsx index c4c454a..625b9f0 100644 Binary files a/Data/Resources/Metatable/Excel/Icons.xlsx and b/Data/Resources/Metatable/Excel/Icons.xlsx differ diff --git a/Data/Scripts/Editor/AssetBrowser.lua b/Data/Scripts/Editor/AssetBrowser.lua index 42f4d71..37e9358 100644 --- a/Data/Scripts/Editor/AssetBrowser.lua +++ b/Data/Scripts/Editor/AssetBrowser.lua @@ -39,7 +39,7 @@ AssetBrowser.OnGUI = function(self) Engine.Rendering.SetVector2("gamelab_ui_position", {0, 0}) --Engine.Rendering.SetTexture("gamelab_main_tex", tex) --Engine.Rendering.DrawUIQuad({0, 0, 200, 200}) - Editor.GUI.Text(_G["default_font"], "你好世界!\nHello,World!\nProject Window Properties", 12) + Editor.GUI.Text(_G["default_font"], "你好世界!\nMaterials\nHello,World!\nProject Window Properties", 12) -- Engine.Rendering.SetVector2("gamelab_ui_position", {0, 100}) -- Editor.GUI.Text(_G["default_font"], "你好世界!\nHello,World!\nProject Window Properties", 12) diff --git a/Data/Scripts/EditorApplication.lua b/Data/Scripts/EditorApplication.lua index 0576994..4c91f72 100644 --- a/Data/Scripts/EditorApplication.lua +++ b/Data/Scripts/EditorApplication.lua @@ -21,16 +21,20 @@ local mainWindow = GUI.ContainerWindow.New({400, 400, 800, 500}, GUI.EShowMode.M mainWindow:SetTitle("GameLab") mainWindow:SetIcon("./Data/Icon/GameLab.ico") -app:SetMainWindow(mainWindow) +app:SetMainWindow(mainWindow:GetInternal()) local guiWindow = GUI.GUIWindow.New() guiWindow:SetContainerWindow(mainWindow) guiWindow:SetPosition({0,0, 400, 400}) + +local guiWindow2 = GUI.GUIWindow.New() +guiWindow2:SetContainerWindow(mainWindow) +guiWindow2:SetPosition({500,0, 400, 400}) + collectgarbage() local wnd = AssetBrowser.New() -guiWindow:SetInstance(wnd) local v = GameLab.Engine.Math.Vector4.New(1,2,3,4) @@ -57,45 +61,6 @@ local tex = Engine.Resource.LoadTexture("./Resources/Images/brickwall.jpg") local request = Engine.Resource.LoadImageDataAsync("./Resources/Images/brickwall.jpg") -local vsh = [[ - #version 330 core - layout (location = 0) in vec3 aPos; - layout (location = 1) in vec3 aColor; - layout (location = 2) in vec2 aTexCoord; - - out vec3 ourColor; - out vec2 TexCoord; - - void main() - { - gl_Position = vec4(aPos, 1.0); - ourColor = aColor; - TexCoord = vec2(aTexCoord.x, aTexCoord.y); - } -]] - -local fsh = [[ - #version 330 core - out vec4 FragColor; - - in vec3 ourColor; - in vec2 TexCoord; - - uniform float mixValue; - - // texture samplers - uniform sampler2D texture1; - uniform sampler2D texture2; - - void main() - { - // linearly interpolate between both textures - FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), mixValue); - } -]] - -BeforeMainLoop() - local font = Engine.GUI.Font.New("./Resources/Font/msyh.ttc", {512, 512}, 5, 5) _G["default_font"] = font diff --git a/Data/Scripts/macro.lua b/Data/Scripts/macro.lua new file mode 100644 index 0000000..c8a4895 --- /dev/null +++ b/Data/Scripts/macro.lua @@ -0,0 +1,3 @@ +-- "macros" +GAMELAB_PROFILE = true +GAMELAB_DEBUG = true diff --git a/Data/Scripts/settings.lua b/Data/Scripts/settings.lua new file mode 100644 index 0000000..c837e5c --- /dev/null +++ b/Data/Scripts/settings.lua @@ -0,0 +1,9 @@ +local opentags = { + "WndProc", +} + +local Debug = GameLab.Debug + +for _, tag in ipairs(opentags) do + Debug.OpenTag(tag) +end diff --git a/Data/boot.lua b/Data/boot.lua index ad8f4da..7b9dda0 100644 --- a/Data/boot.lua +++ b/Data/boot.lua @@ -1,5 +1,3 @@ -require("macro") - -- 模块搜索目录 local engineLuaLibs = "./DefaultContent/Libraries/?.lua" .. ";./DefaultContent/Libraries/?/init.lua" .. ";./DefaultContent/Libraries/?/?.lua" .. ";./DefaultContent/Libraries/?/?" .. ";./DefaultContent/Plugins/?.lua" .. ";./DefaultContent/Plugins/?/init.lua" .. ";./DefaultContent/Plugins/?/?.lua" .. ";./DefaultContent/Plugins/?/?" @@ -12,6 +10,9 @@ local engineCLibs = "./DefaultContent/Libraries/?.dll" .. ";./DefaultContent/Plu local editorCLibs = "./Libraries/?.dll" .. "./Plugins/?.dll" package.cpath=package.cpath .. ";" .. engineCLibs .. ";" .. editorCLibs +require("macro") +require("settings") + -- debugging -- 在这里会报一个异常, 不知道为什么 --require("LuaPanda").start("127.0.0.1",8818) diff --git a/Data/macro.lua b/Data/macro.lua deleted file mode 100644 index c8a4895..0000000 --- a/Data/macro.lua +++ /dev/null @@ -1,3 +0,0 @@ --- "macros" -GAMELAB_PROFILE = true -GAMELAB_DEBUG = true -- cgit v1.1-26-g67d0