changes
This commit is contained in:
@@ -12,7 +12,7 @@ function EButton:initialize()
|
||||
self:setText("Button")
|
||||
self:setSize(100, 32)
|
||||
self:setRoundedCorners(true)
|
||||
self:setRadius(5)
|
||||
self:setRadius(0)
|
||||
self:setColorScheme({
|
||||
bg = {
|
||||
Color(46, 46, 46),
|
||||
|
||||
@@ -48,8 +48,7 @@ function ECheckbox:paint(x, y, w, h)
|
||||
render.drawRectFast(x + 4, y + 4, w - 8, h - 8)
|
||||
|
||||
render.setColor(self:getColorFromScheme("border"))
|
||||
render.drawRectOutline(x, y, w, h, 1)
|
||||
render.drawRectOutline(x + 1, y + 1, w - 2, h - 2, 1)
|
||||
render.drawRectOutline(x, y, w, h, 2)
|
||||
end
|
||||
|
||||
-- STUB
|
||||
|
||||
12
koptilnya/gui/elements/icon_button.txt
Normal file
12
koptilnya/gui/elements/icon_button.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
--@include button.txt
|
||||
--@include radius_mixin.txt
|
||||
|
||||
require("label.txt")
|
||||
|
||||
EIconButton = class("EIconButton", EButton)
|
||||
|
||||
function EIconButton:initialize()
|
||||
EButton.initialize(self)
|
||||
|
||||
self:setFont(GUI.fonts.icons)
|
||||
end
|
||||
@@ -8,6 +8,7 @@ ELabel = class("ELabel", Element)
|
||||
|
||||
function ELabel:initialize()
|
||||
Element.initialize(self)
|
||||
|
||||
self._text = ""
|
||||
self._textWidth = 0
|
||||
self._textHeight = 0
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
--@include label.txt
|
||||
--@include button.txt
|
||||
--@include /koptilnya/libs/utils.txt
|
||||
--@include /koptilnya/gui/segoe_mdl2_assets_icons.txt
|
||||
|
||||
require("element.txt")
|
||||
require("label.txt")
|
||||
require("button.txt")
|
||||
require("/koptilnya/libs/utils.txt")
|
||||
|
||||
local segoeIcons = require("/koptilnya/gui/segoe_mdl2_assets_icons.txt")
|
||||
|
||||
EPanel = class("EPanel", Element)
|
||||
|
||||
accessorFunc(EPanel, "_parentLock", "ParentLock", false)
|
||||
@@ -15,6 +18,8 @@ accessorFunc(EPanel, "_parentLock", "ParentLock", false)
|
||||
function EPanel:initialize()
|
||||
Element.initialize(self)
|
||||
|
||||
self._minimizable = true
|
||||
self._closeable = true
|
||||
self._minimized = false
|
||||
self._lastHeight = 0
|
||||
|
||||
@@ -32,7 +37,7 @@ function EPanel:initialize()
|
||||
|
||||
self.minimizeButton = EButton:new()
|
||||
self.minimizeButton:setFont(GUI.fonts["icons"])
|
||||
self.minimizeButton:setText(string.utf8char(0xE73F))
|
||||
self.minimizeButton:setText(segoeIcons.ChromeMinimize)
|
||||
self.minimizeButton:setSize(32, 32)
|
||||
self.minimizeButton:setRadius(0)
|
||||
self.minimizeButton:setColorScheme(colorScheme)
|
||||
@@ -43,7 +48,7 @@ function EPanel:initialize()
|
||||
|
||||
self.closeButton = EButton:new()
|
||||
self.closeButton:setFont(GUI.fonts["icons"])
|
||||
self.closeButton:setText(string.utf8char(0xE006))
|
||||
self.closeButton:setText(string.utf8char(0xE8BB))
|
||||
self.closeButton:setSize(32, 32)
|
||||
self.closeButton:setRadius(0)
|
||||
self.closeButton:setColorScheme(colorScheme)
|
||||
@@ -74,28 +79,52 @@ function EPanel:getTitle()
|
||||
return self.title:getText()
|
||||
end
|
||||
|
||||
function EPanel:setMinimized(state)
|
||||
self._minimized = state
|
||||
function EPanel:setMinimizable(state)
|
||||
self._minimizable = state
|
||||
|
||||
self.minimizeButton:setEnabled(state)
|
||||
self.minimizeButton:setVisible(state)
|
||||
end
|
||||
|
||||
function EPanel:isMinimizable()
|
||||
return self._minimizable
|
||||
end
|
||||
|
||||
function EPanel:setCloseable(state)
|
||||
self._closeable = state
|
||||
|
||||
self.closeButton:setEnabled(state)
|
||||
self.closeButton:setVisible(state)
|
||||
end
|
||||
|
||||
function EPanel:isMinimized()
|
||||
return self._minimized
|
||||
end
|
||||
|
||||
function EPanel:setMinimized(state)
|
||||
self._minimized = state
|
||||
end
|
||||
|
||||
function EPanel:isCloseable()
|
||||
return self._minimizable
|
||||
end
|
||||
|
||||
function EPanel:close()
|
||||
self:setVisible(false)
|
||||
self:setEnabled(false)
|
||||
self:onClose()
|
||||
end
|
||||
|
||||
function EPanel:open()
|
||||
self:setVisible(true)
|
||||
self:setEnabled(true)
|
||||
self:onOpen()
|
||||
end
|
||||
|
||||
function EPanel:minimize()
|
||||
self._lastHeight = self:getHeight()
|
||||
|
||||
self.minimizeButton:setText(string.utf8char(10063))
|
||||
self.minimizeButton:setText(segoeIcons.ChromeMaximize)
|
||||
self:setMinimized(true)
|
||||
self:setHeight(34)
|
||||
|
||||
@@ -110,7 +139,7 @@ function EPanel:minimize()
|
||||
end
|
||||
|
||||
function EPanel:maximize()
|
||||
self.minimizeButton:setText("_")
|
||||
self.minimizeButton:setText(segoeIcons.ChromeMinimize)
|
||||
self:setMinimized(false)
|
||||
self:setHeight(self._lastHeight)
|
||||
|
||||
@@ -181,4 +210,12 @@ function EPanel:paint(x, y, w, h)
|
||||
|
||||
render.setColor(self:getColorFromScheme("bg"))
|
||||
render.drawRectFast(x + 1, y + 33, w - 2, h - 34)
|
||||
end
|
||||
|
||||
-- STUB
|
||||
|
||||
function EPanel:onClose()
|
||||
end
|
||||
|
||||
function EPanel:onOpen()
|
||||
end
|
||||
@@ -10,6 +10,6 @@ accessorFunc(EShape, "_color", "Color", Color(255, 255, 255))
|
||||
accessorFunc(EShape, "_hoveredColor", "HoveredColor", Color(150, 150, 150))
|
||||
|
||||
function EShape:paint(x, y, w, h)
|
||||
render.setColor(self:isHovered() and self:getHoveredColor() or self:getColor())
|
||||
render.setColor(self:getColor())
|
||||
render.drawRectFast(x, y, w, h)
|
||||
end
|
||||
@@ -8,14 +8,14 @@ GUI = class("GUI")
|
||||
|
||||
GUI.static.fonts = {
|
||||
main = render.createFont("Roboto", 16, 700, true),
|
||||
icons = render.createFont("Segoe MDL2 Assets", 32, 400, true)
|
||||
icons = render.createFont("Segoe MDL2 Assets", 16, 400, true, false, false, false, false, true)
|
||||
}
|
||||
|
||||
function GUI:initialize(renderDevice)
|
||||
checkVarClass(renderDevice, RenderDevice)
|
||||
|
||||
self.renderDevice = renderDevice
|
||||
self._root = ERoot:new("root")
|
||||
self._root = ERoot:new()
|
||||
self._root:setSize(renderDevice:getSize())
|
||||
|
||||
hook.add("inputPressed", "gui_inputPressed", function(key)
|
||||
|
||||
@@ -5,12 +5,15 @@ require("render_device.txt")
|
||||
RenderDeviceHUD = class("RenderDeviceHUD", RenderDevice)
|
||||
|
||||
function RenderDeviceHUD:initialize()
|
||||
enableHud(player(), true)
|
||||
--if player() == owner() then
|
||||
-- enableHud(player(), true)
|
||||
--end
|
||||
|
||||
self:setSize(render.getResolution())
|
||||
|
||||
hook.add("hudshoulddraw", "gui_hudshoulddraw", function(name)
|
||||
return name == "CHudGMod" or name == "CHudChat"
|
||||
end)
|
||||
--hook.add("hudshoulddraw", "gui_hudshoulddraw", function(name)
|
||||
-- return name == "CHudGMod" or name == "CHudChat"
|
||||
--end)
|
||||
|
||||
hook.add("postdrawhud", "gui_renderer", function()
|
||||
self:render()
|
||||
|
||||
@@ -4,6 +4,7 @@ require("/koptilnya/libs/utils.txt")
|
||||
|
||||
RenderDevice = class("RenderDevice")
|
||||
|
||||
accessorFunc(RenderDevice, "_player", "Player", nil)
|
||||
accessorFunc(RenderDevice, "_width", "Width", 0)
|
||||
accessorFunc(RenderDevice, "_height", "Height", 0)
|
||||
|
||||
@@ -24,5 +25,7 @@ function RenderDevice:getSize()
|
||||
return self:getWidth(), self:getHeight()
|
||||
end
|
||||
|
||||
-- STUB
|
||||
|
||||
function RenderDevice:render()
|
||||
end
|
||||
1384
koptilnya/gui/segoe_mdl2_assets_icons.txt
Normal file
1384
koptilnya/gui/segoe_mdl2_assets_icons.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user