summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
Diffstat (limited to 'Data')
-rw-r--r--Data/BuiltIn/Libraries/GameLab/Class.lua9
-rw-r--r--Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua31
-rw-r--r--Data/BuiltIn/Libraries/GameLab/GlobalClass.lua2
-rw-r--r--Data/Libraries/GameLab/Editor/Window/GUIWindow.lua4
-rw-r--r--Data/Resources/Shaders/Editor-Text.glsl2
-rw-r--r--Data/Scripts/EditorApplication.lua2
-rw-r--r--Data/boot.lua9
7 files changed, 39 insertions, 20 deletions
diff --git a/Data/BuiltIn/Libraries/GameLab/Class.lua b/Data/BuiltIn/Libraries/GameLab/Class.lua
index e30aab7..7e2502d 100644
--- a/Data/BuiltIn/Libraries/GameLab/Class.lua
+++ b/Data/BuiltIn/Libraries/GameLab/Class.lua
@@ -113,4 +113,13 @@ end
GameLab.Class = class
+local function affirmClass(_, classname)
+ return function()
+ return "foookok"
+ end
+end
+CLASS = setmetatable({}, {__index = affirmClass})
+
+Class = class
+
return class \ No newline at end of file
diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua
index cf84bff..084cc81 100644
--- a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua
+++ b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua
@@ -14,6 +14,9 @@ local Matrix44 = find "GameLab.Engine.Math.Matrix44"
local Rendering = GameLab.Engine.Rendering
local EEventType = GameLab.Events.EEventType
local Resource = GameLab.Engine.Resource
+local Vector2 = GameLab.Engine.Math.Vector2
+local Vector4 = GameLab.Engine.Math.Vector4
+local Color = Rendering.Color
local EditorRes
if GAMELAB_EDITOR then
@@ -51,8 +54,6 @@ end
GUI.Label = function()
end
-local shader
-local tex
GUI.Box = function(position, color, size)
if Event.current.type == EEventType.Repaint then
@@ -61,23 +62,16 @@ GUI.Box = function(position, color, size)
--Rendering.UseShader(Res.shaders["EditorShape"])
local ortho = Matrix44()
ortho:SetOrtho(0, size.x, size.y, 0, 0.1, 10)
- if shader == nil then
- shader = Rendering.Shader.CreateFromFile("./Resources/Shaders/Editor-Text.glsl")
- --shader = Rendering.Shader.CreateFromFile("./Resources/Shaders/Editor-UI.glsl")
- end
- if tex == nil then
- tex = Resource.LoadTexture("./Resources/Images/tile.png")
- --tex = Engine.Resource.LoadTexture("./Resources/Images/brickwall_small.jpg")
- end
- Rendering.UseShader(shader)
+ Rendering.UseShader(Res.shaders["EditorShape"])
Rendering.SetMatrix44("gamelab_mat_mvp", ortho)
Rendering.SetVector2("gamelab_ui_position", {0, 0})
+ Rendering.SetVector4("gamelab_color", Vector4(0.12, 0.12, 0.12, 1))
--Rendering.SetTexture("gamelab_main_tex", tex)
--Rendering.DrawUIQuad({0, 0, 200, 200})
--Rendering.DrawUI9Slicing(1, {25, 25}, {25, 25}, {80, 80}, {400, 30} )
- EditorGUI.Text(_G["default_font"], "你好世界!\nMaterials\nHello,World!\nProject Window Properties", 12)
- --EditorGUI.Text(_G["default_font"], "hello", 12)
+ --GUI.DrawText(_G["default_font"], "你好世界!\nMaterials\nHello,World!\nProject Window Properties", 12)
+ GUI.Line(Vector2(0, 0), Vector2(100, 100))
end
end
@@ -109,8 +103,15 @@ GUI.HorizontalScrollbar = function()
end
-GUI.DrawLine = function()
+GUI.Line = function(from, to)
+ if Event.current.type ~= EEventType.Repaint then
+ return
+ end
+ GUI.DrawLine(from, to)
+end
+
+GUI.BoxFrame = function(topleft, size)
end
-return GUI \ No newline at end of file
+return GUI \ No newline at end of file
diff --git a/Data/BuiltIn/Libraries/GameLab/GlobalClass.lua b/Data/BuiltIn/Libraries/GameLab/GlobalClass.lua
index 7104480..3d2b166 100644
--- a/Data/BuiltIn/Libraries/GameLab/GlobalClass.lua
+++ b/Data/BuiltIn/Libraries/GameLab/GlobalClass.lua
@@ -18,4 +18,6 @@ end
GameLab.GlobalClass = GlobalClass
+GClass = GlobalClass
+
return GlobalClass \ No newline at end of file
diff --git a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua
index f1f4445..b5d7436 100644
--- a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua
+++ b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua
@@ -40,7 +40,7 @@ local GUIWindow = GameLab.GlobalClass("GameLab.Editor.Window.GUIWindow", functio
i = i + 1
self.m_ClearColor = col[i]
-end )
+end)
GUIWindow.get_native = function(self)
return self.m_Native
@@ -127,7 +127,7 @@ end
GUIWindow.ClearBackground = function(self)
if Event.current.type == EEventType.Repaint then
- GL.ClearColor(self.m_ClearColor)
+ GL.ClearColor(Color(0.16,0.16,0.16,1 ))
GL.Clear(GL.EBufferType.ColorBuffer)
end
end
diff --git a/Data/Resources/Shaders/Editor-Text.glsl b/Data/Resources/Shaders/Editor-Text.glsl
index 3c1ad4f..7db820c 100644
--- a/Data/Resources/Shaders/Editor-Text.glsl
+++ b/Data/Resources/Shaders/Editor-Text.glsl
@@ -36,7 +36,7 @@ out vec4 FragColor;
void main()
{
- vec4 sampled = vec4(0.8,0.8,0.8,texture(gamelab_main_tex, uv).r);
+ vec4 sampled = vec4(1,1,1,texture(gamelab_main_tex, uv).r);
sampled *= color;
FragColor = sampled;
}
diff --git a/Data/Scripts/EditorApplication.lua b/Data/Scripts/EditorApplication.lua
index 1a31cdd..ad30d3a 100644
--- a/Data/Scripts/EditorApplication.lua
+++ b/Data/Scripts/EditorApplication.lua
@@ -1,3 +1,5 @@
+setfenv(1, _G)
+
local json = require "LiteJson.json"
local inspect = require "inspect"
local AssetBrowser = require "./Scripts/Editor/AssetBrowser"
diff --git a/Data/boot.lua b/Data/boot.lua
index 94dabd1..6807de6 100644
--- a/Data/boot.lua
+++ b/Data/boot.lua
@@ -22,14 +22,19 @@ if GAMELAB_DEBUG then
print = GameLab.Debug.Log
end
+-- gamelab enviroument
+local env = {}
+setmetatable(env, {__index = _G})
+setfenv(1, env)
+
-- load gamelab modules
require "GameLab"
require "GameLab.Containers"
require "GameLab.Utils"
require "GameLab.Events"
require "GameLab.Engine"
-require "GameLab.Engine.GUI"
require "GameLab.Engine.Math"
+require "GameLab.Engine.GUI"
require "GameLab.Engine.Rendering"
require "GameLab.Engine.Resource"
require "GameLab.Engine.GL"
@@ -37,7 +42,7 @@ require "GameLab.Editor"
require "GameLab.Editor.Window"
-- debugging
-require("LuaPanda").start("127.0.0.1",8818)
+--require("LuaPanda").start("127.0.0.1",8818)
-- launch editor
dofile("./Scripts/EditorApplication.lua")