summaryrefslogtreecommitdiff
path: root/Data/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Data/Libraries')
-rw-r--r--Data/Libraries/GameLab/Editor/Window/GUIWindow.lua37
-rw-r--r--Data/Libraries/GameLab/Editor/Window/SplitWindow.lua6
2 files changed, 29 insertions, 14 deletions
diff --git a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua
index e2ceee5..c430cfd 100644
--- a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua
+++ b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua
@@ -9,10 +9,11 @@ local Utils = require "GameLab.Utils"
local Events = require "GameLab.Events"
local GUI = require "GameLab.Engine.GUI"
-local Rect = Math.Rect
-local Event = Events.Event
-local Vector2 = Math.Vector2
-local Color = Rendering.Color
+local Rect = Math.Rect
+local Event = Events.Event
+local EEventType = Events.EEventType
+local Vector2 = Math.Vector2
+local Color = Rendering.Color
local clone = Utils.Clone
@@ -99,20 +100,22 @@ end
-- 最主要的回调函数,同时处理窗口管理、事件、布局、渲染
GUIWindow.OnGUI = function(self)
Debug.Log("OnGUI")
- self:ClearBackground()
local event = Event.current
- local sp = self.splitWindow
- if sp ~= nil and event ~= nil then
- local e = clone(event)
- e.mousePosition:Add(self.position.xy) -- 坐标转换到全局containerWindow的坐标
- sp:DoSplit(e)
+ if event.type ~= EEventType.Repaint then
+ local sp = self.splitWindow
+ if sp ~= nil and event ~= nil then
+ local e = clone(event)
+ e.mousePosition:Add(self.position.xy) -- 坐标转换到全局containerWindow的坐标
+ sp:DoSplit(e)
+ end
end
+ self:ClearBackground()
GUI.Box(Rect(), Color(), self.position.size)
-end
+end
GUIWindow.GetContainerWindow = function(self)
return self.m_ContainerWindow
@@ -120,11 +123,17 @@ end
GUIWindow.OnFocus = function(self)
Debug.Log("GUIWindow.OnFocus")
-end
+end
GUIWindow.ClearBackground = function(self)
- GL.ClearColor(self.m_ClearColor)
- GL.Clear(GL.EBufferType.ColorBuffer)
+ if Event.current.type == EEventType.Repaint then
+ GL.ClearColor(self.m_ClearColor)
+ GL.Clear(GL.EBufferType.ColorBuffer)
+ end
end
+GUIWindow.DoRepaint = function(self)
+ self.m_Native:DoPaint()
+end
+
return GUIWindow \ No newline at end of file
diff --git a/Data/Libraries/GameLab/Editor/Window/SplitWindow.lua b/Data/Libraries/GameLab/Editor/Window/SplitWindow.lua
index fea443d..cd8d3a3 100644
--- a/Data/Libraries/GameLab/Editor/Window/SplitWindow.lua
+++ b/Data/Libraries/GameLab/Editor/Window/SplitWindow.lua
@@ -179,4 +179,10 @@ SplitWindow.AddSubWindow = function(self, subWindow)
subWindow.m_Parent = self
end
+SplitWindow.DoRepaint = function(self)
+ for _, wnd in ipairs(self.m_SubWindows) do
+ wnd:DoRepaint()
+ end
+end
+
return SplitWindow \ No newline at end of file