diff options
-rw-r--r-- | Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua | 44 | ||||
-rw-r--r-- | Data/BuiltIn/Libraries/GameLab/init.lua | 2 | ||||
-rw-r--r-- | Data/Libraries/GameLab/Editor/Window/GUIWindow.lua | 2 |
3 files changed, 42 insertions, 6 deletions
diff --git a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua index e7f29c6..afadee8 100644 --- a/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua +++ b/Data/BuiltIn/Libraries/GameLab/Engine/Math/Rect.lua @@ -1,4 +1,5 @@ local Rect = GameLab.GlobalClass("GameLab.Engine.Math.Rect")
+local Vector2 = GameLab.Include("GameLab.Engine.Math.Vector2")
Rect.Ctor = function(self, x, y, width, height)
self.x = x or 0
@@ -8,12 +9,12 @@ Rect.Ctor = function(self, x, y, width, height) end
Rect.Set = function(self, rect)
- if rect._type and rect._type.fullName == "GameLab.Engine.Math.Rect" then
+ 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
- else
+ else
self.x = rect.x or rect[1]
self.y = rect.y or rect[2]
self.width = rect.z or rect[3]
@@ -21,13 +22,46 @@ Rect.Set = function(self, rect) end
end
-Rect.GetPosition = function(self)
- local v = GameLab.Engine.Math.Vector2(self.x, self.y)
+Rect.get_xy = function(self)
+ local v = Vector2(self.x, self.y)
return v
end
+Rect.get_location = function(self)
+ local v = Vector2(self.x, self.y)
+ return v
+end
+
+Rect.get_position = Rect.get_location
+
+Rect.get_wh = function(self)
+ local v = Vector2(self.width, self.height)
+ return v
+end
+
+Rect.get_size = function(self)
+ local v = Vector2(self.width, self.height)
+ return v
+end
+
+Rect.get_w = function(self)
+ return self.width
+end
+
+Rect.set_w = function(self, w)
+ self.width = w
+end
+
+Rect.get_h = function(self)
+ return self.height
+end
+
+Rect.set_h = function(self, h)
+ self.height = h
+end
+
Rect.GetSize = function(self)
- local v = GameLab.Engine.Math.Vector2(self.width, self.height)
+ local v = Vector2(self.width, self.height)
return v
end
diff --git a/Data/BuiltIn/Libraries/GameLab/init.lua b/Data/BuiltIn/Libraries/GameLab/init.lua index b0c3780..de60ca3 100644 --- a/Data/BuiltIn/Libraries/GameLab/init.lua +++ b/Data/BuiltIn/Libraries/GameLab/init.lua @@ -27,6 +27,8 @@ GameLab.Find = function(name) return m
end
+GameLab.Include = GameLab.Find
+
local import = GameLab.Import(...)
import "Package"
diff --git a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua index 2df0e49..53f08a8 100644 --- a/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua +++ b/Data/Libraries/GameLab/Editor/Window/GUIWindow.lua @@ -91,7 +91,7 @@ GUIWindow.OnGUI = function(self) if self.splitWindow ~= nil and event ~= nil then
local e = clone(event)
- e.mousePosition:Add(self.m_Position:GetPosition()) -- 坐标转换到全局containerWindow的坐标
+ e.mousePosition:Add(self.position.xy) -- 坐标转换到全局containerWindow的坐标
self.splitWindow:DoSplit(e)
end
end
|