fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

blackops7799More config file work (exporting/importing/defaults) Properly cleanup orphaned panels and "removed" panels SetZPos will now reorder the parents child panels MakePopup will take the place of the highest Z positioned panel29daa42

GUI
1.3 KiB45 linesraw
1function PANEL:Initialize()
2	self:super()
3
4	self:DockPadding(0,1,0,1)
5
6	self.m_pLuaMemory = self:Add("Label")
7	self.m_pLuaMemory:DockMargin(0,0,0,0)
8	self.m_pLuaMemory:Dock(DOCK_RIGHT)
9	self.m_pLuaMemory:SetWidth(128)
10	self.m_pLuaMemory:SetTextAlignment("left")
11
12	self.m_pGPUMemory = self:Add("Label")
13	self.m_pGPUMemory:DockMargin(0,0,0,0)
14	self.m_pGPUMemory:Dock(DOCK_RIGHT)
15	self.m_pGPUMemory:SetWidth(128)
16	self.m_pGPUMemory:SetTextAlignment("left")
17
18	self.m_pCanvasSize = self:Add("Button")
19	self.m_pCanvasSize:DockMargin(0,0,0,0)
20	self.m_pCanvasSize:Dock(DOCK_LEFT)
21	self.m_pCanvasSize:SetTextAlignment("left")
22	self.m_pCanvasSize:SetBGColor(color_blank)
23	self.m_pCanvasSize:SetBorderColor(color_blank)
24
25	self.m_pCanvasSize.OnClick = function(this)
26		local edit = gui.create("CanvasEditor")
27		edit:Center()
28		edit:MakePopup()
29	end
30end
31
32function PANEL:Think(dt)
33	self.m_pLuaMemory:SetText(string.format(" RAM: %s ", string.toSize(collectgarbage("count")*1024)))
34
35	local stats = graphics.getStats()
36
37	self.m_pGPUMemory:SetText(string.format(" GPU: %s ", string.toSize(stats.texturememory)))
38
39	local canvas = self:GetParent():GetDisplay()
40
41	self.m_pCanvasSize:SetText(string.format(" Canvas: %dx%d ", canvas:GetSize()))
42	self.m_pCanvasSize:WidthToText()
43end
44
45gui.register("SceneInfoBar", PANEL, "Panel")