summaryrefslogtreecommitdiff
path: root/Data/BuiltIn
diff options
context:
space:
mode:
Diffstat (limited to 'Data/BuiltIn')
-rw-r--r--Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua39
-rw-r--r--Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua8
2 files changed, 32 insertions, 15 deletions
diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua
index c2677bc..a16c2ed 100644
--- a/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua
+++ b/Data/BuiltIn/Libraries/GameLab/Engine/GUI/IMGUI.lua
@@ -12,6 +12,8 @@ local shaders = Res.shaders
local GL = GameLab.Engine.GL
local Matrix44 = find "GameLab.Engine.Math.Matrix44"
local Rendering = GameLab.Engine.Rendering
+local EEventType = GameLab.Events.EEventType
+local Resource = GameLab.Engine.Resource
GUI.BeginOnGUI = function()
GUIState.ResetControlID()
@@ -45,18 +47,33 @@ GUI.Label = function()
end
local shader
+local tex
+
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")
- end
-
- Rendering.UseShader(shader)
- Rendering.SetMatrix44("gamelab_mat_mvp", ortho)
- Rendering.SetVector2("gamelab_ui_position", {0, 0})
- EditorGUI.Text(_G["default_font"], "你好世界!\nMaterials\nHello,World!\nProject Window Properties", 12)
+ if Event.current.type == EEventType.Repaint then
+ -- GL.ClearColor({0.13, 0.13, 0.13, 1})
+ -- GL.Clear(GL.EBufferType.ColorBuffer)
+ --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.SetMatrix44("gamelab_mat_mvp", ortho)
+ Rendering.SetVector2("gamelab_ui_position", {0, 0})
+ --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)
+ end
end
GUI.HorizontalSlider = function()
diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua
index afadee8..2a1733a 100644
--- a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua
+++ b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua
@@ -10,10 +10,10 @@ end
Rect.Set = function(self, rect)
if rect.Is and rect:Is(Rect) then
- self.x = rect.x or rect.x
- self.y = rect.y or rect.y
- self.width = rect.z or rect.width
- self.height = rect.w or rect.height
+ self.x = rect.x
+ self.y = rect.y
+ self.width = rect.width
+ self.height = rect.height
else
self.x = rect.x or rect[1]
self.y = rect.y or rect[2]