diff options
Diffstat (limited to 'Resources')
16 files changed, 85 insertions, 27 deletions
diff --git a/Resources/.vscode/launch.json b/Resources/.vscode/launch.json index 4248412..94088ea 100644 --- a/Resources/.vscode/launch.json +++ b/Resources/.vscode/launch.json @@ -13,12 +13,12 @@ "cwd": "${workspaceFolder}", "luaFileExtension": "", "connectionPort": 8818, - "stopOnEntry": true, + "stopOnEntry": false, "useCHook": true, "autoPathMode": true, // 自动启动编辑器 - // https://stackoverflow.com/questions/34698230/how-to-run-multiple-commands-via-start-command/34698365 - "preLaunchTask": "LaunchEditor", "postDebugTask": "KillEditor" + "program": "${workspaceFolder}/../Build/Editor.exe", "postDebugTask": "KillEditor" + //"preLaunchTask": "LaunchEditor", "postDebugTask": "KillEditor" }, { "type": "lua", @@ -30,7 +30,7 @@ "packagePath": [], "luaFileExtension": "", "connectionPort": 8820, - "stopOnEntry": true, + "stopOnEntry": false, "useCHook": true } ] diff --git a/Resources/.vscode/tasks.json b/Resources/.vscode/tasks.json index a7dffbb..6409b18 100644 --- a/Resources/.vscode/tasks.json +++ b/Resources/.vscode/tasks.json @@ -9,7 +9,11 @@ { "label": "KillEditor", "type": "shell", - "command": "${workspaceFolder}/.vscode/KillEditor.bat" + "command": "${workspaceFolder}/.vscode/KillEditor.bat", + "isBackground": true, + "presentation": { + "reveal": "never" // 在终端里隐藏 + }, } ] }
\ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Class.lua b/Resources/DefaultContent/Libraries/GameLab/Class.lua index 5a3a962..62369e1 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Class.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Class.lua @@ -1,11 +1,14 @@ -- Declare class
-local _class = function (className, pkg)
+local _class = function (className)
local class = {}
+ local pkgName = (type(className) == "string") and string.match(className, "^(.+)%.%w+$") or ""
+ local shortName = (type(className) == "string") and string.match(className, "%.*(%w+)$") or ""
class._type = { -- 类型元数据,GameLab的类型都会包含这些
mode = "lua",
- name = className,
- package = pkg,
+ name = shortName or "",
+ package = pkgName or "",
+ fullName = className
}
class.__index = class
class.New = function(...)
@@ -17,11 +20,11 @@ local _class = function (className, pkg) return class
end
--- 提供ClassName和PkgName作为类型的元数据,可以留空,但是最好提供
-local Class = function(className, pkg)
- local cls = _class(className, pkg)
- cls.Extend = function(childName, childPkg)
- local child = _class(childName, childPkg)
+-- 提供ClassName和PkgName作为类型的元数据,可以留空,但是最好提供,会作为类型判断的依据
+local Class = function(className)
+ local cls = _class(className)
+ cls.Extend = function(childName)
+ local child = _class(childName)
if cls then
setmetatable(child, cls)
child.base = cls
diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Math.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Math.lua index 4ec067e..0bbe7f0 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Math.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Math.lua @@ -1,6 +1,6 @@ -- 数学函数 -GameLab.Engine.Math = GameLab.Engine.Math or {} -local m = GameLab.Engine.Math +local m = GameLab.Engine.Math or {} +GameLab.Engine.Math = m m.Abs = function(n) diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix3x3.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix3x3.lua index f7dc352..b0aad47 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix3x3.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix3x3.lua @@ -1,4 +1,4 @@ -local Matrix3x3 = GameLab.Class("Matrix3x3", "GameLab.Engine.Math") +local Matrix3x3 = GameLab.Class("GameLab.Engine.Math.Matrix3x3") Matrix3x3.Ctor = function(self) diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua index e69de29..8e4d70a 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Matrix4x4.lua @@ -0,0 +1,31 @@ +local Matrix4x4 = GameLab.Class("GameLab.Engine.Math.Matrix4x4") + +Matrix4x4.Ctor = function(self) + for r = 0, 3 do + for c = 0, 3 do + self["m"..r..c] = 0 + end + end +end + +Matrix4x4.SetRow = function(self, row, value) + +end + +Matrix4x4.SetColum = function(self, colum, value) + +end + +Matrix4x4.Set = function(self, row, colum ,value) + +end + +Matrix4x4.GetColum = function(self, colum) + +end + +Matrix4x4.GetRow = function(self, row) + +end + +return Matrix4x4
\ No newline at end of file diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua index dc961b2..5697797 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector2.lua @@ -1,4 +1,4 @@ -local Vector2 = GameLab.Class("Vector2", "GameLab.Engine.Math")
+local Vector2 = GameLab.Class("GameLab.Engine.Math.Vector2")
diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua index f355a65..caa28a4 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector3.lua @@ -1,4 +1,4 @@ -local Vector3 = GameLab.Class("Vector3", "GameLab.Engine.Math")
+local Vector3 = GameLab.Class("GameLab.Engine.Math.Vector3")
diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua index 84a114f..e232c93 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Math/Vector4.lua @@ -1,4 +1,4 @@ -local Vector4 = GameLab.Class("Vector4", "GameLab.Engine.Math")
+local Vector4 = GameLab.Class("GameLab.Engine.Math.Vector4")
Vector4.Ctor = function (self, x, y, z, w)
self.x = x or 0
diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua index 56063f6..fb3e773 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color.lua @@ -1,4 +1,4 @@ -local Color = GameLab.Class("Color", "GameLab.Engine.Rendering") +local Color = GameLab.Class("GameLab.Engine.Rendering.Color") GameLab.Engine.Rendering.Color = Color -- 避免require循环 local Color32 = GameLab.Engine.Rendering.Color32 or require("GameLab.Engine.Rendering.Color32") diff --git a/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua b/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua index ce3967c..c17187a 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Engine/Rendering/Color32.lua @@ -1,4 +1,4 @@ -local Color32 = GameLab.Class("Color32", "GameLab.Engine.Rendering") +local Color32 = GameLab.Class("GameLab.Engine.Rendering.Color32") GameLab.Engine.Rendering.Color32 = Color32 -- 避免require循环 local Color = GameLab.Engine.Rendering.Color or require("GameLab.Engine.Rendering.Color") diff --git a/Resources/Editor.exe b/Resources/Editor.exe Binary files differdeleted file mode 100644 index 7d4ab9d..0000000 --- a/Resources/Editor.exe +++ /dev/null diff --git a/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua b/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua index 22869e5..4f0525f 100644 --- a/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua +++ b/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua @@ -1,4 +1,4 @@ -local EditorWindow = GameLab.Class("EditorWindow", "GameLab.Editor.GUI")
+local EditorWindow = GameLab.Class("GameLab.Editor.GUI.EditorWindow")
EditorWindow.Ctor = function(self, title)
self.title = title -- 编辑器名称
diff --git a/Resources/Scripts/Editor/AssetBrowser.lua b/Resources/Scripts/Editor/AssetBrowser.lua index 06661a2..3d03302 100644 --- a/Resources/Scripts/Editor/AssetBrowser.lua +++ b/Resources/Scripts/Editor/AssetBrowser.lua @@ -1,5 +1,6 @@ local Debug = GameLab.Debug
-local AssetBrowser = GameLab.Editor.GUI.EditorWindow.Extend("AssetBrowser", "GameLab.Editor")
+local AssetBrowser = GameLab.Editor.GUI.EditorWindow.Extend("GameLab.Editor.AssetBrowser")
+local GL = GameLab.Engine.GL
AssetBrowser.Ctor = function(self)
self.base.Ctor(self, "AssetBrowser")
@@ -7,7 +8,15 @@ AssetBrowser.Ctor = function(self) end
AssetBrowser.OnGUI = function(self)
-
+ Debug.Log("AssetBrowser.OnGUI()")
+ GL.ClearColor({0,0,0,1})
+ GL.Clear(GL.EBufferType.ColorBuffer)
+ GL.Color({1,1,0,1})
+ GL.Begin(GL.EPrimitiveType.Triangles)
+ GL.Vertex({0,0,-1})
+ GL.Vertex({0,1,-1})
+ GL.Vertex({1,0,-1})
+ GL.End()
end
AssetBrowser.OnFocus = function(self)
diff --git a/Resources/Scripts/EditorApplication.lua b/Resources/Scripts/EditorApplication.lua index a6515ba..e91725a 100644 --- a/Resources/Scripts/EditorApplication.lua +++ b/Resources/Scripts/EditorApplication.lua @@ -37,8 +37,6 @@ guiWindow:SetInstance(wnd) local v = GameLab.Engine.Math.Vector4.New(1,2,3,4) Debug.Log(inspect(v)) -local V4 = GameLab.Engine.Math.Vector4.Extend("V4", "GameLab.Engine.Math") - Debug.Log(EditorWindowManager.name) local c = Rendering.Color.New(1,1,1,1) @@ -46,7 +44,8 @@ Debug.Log(inspect(c)) Debug.Log(inspect(GL.EBufferType)) -GL.Clear() +GL.ClearColor({1,1,1,1}) +GL.Clear(GL.EBufferType.ColorBuffer) while true do diff --git a/Resources/Shaders/UI.glsl b/Resources/Shaders/UI.glsl new file mode 100644 index 0000000..12a94db --- /dev/null +++ b/Resources/Shaders/UI.glsl @@ -0,0 +1,12 @@ +VERTEX_SHADER_BEGIN + + +VERTEX_SHADER_END + + +FRAGMENT_SHADER_BEGIN + + + + +FRAGMENT_SHADER_END
\ No newline at end of file |