Added themes for menus

master
AlmTech 5 years ago
parent df2c86865e
commit 877801e3c0
  1. 3
      gamemode/engine/derma/cl_menu.lua
  2. 36
      gamemode/engine/derma/lib/cl_menu_theme.lua
  3. 12
      gamemode/engine/derma/menus/menu_character.lua

@ -8,7 +8,8 @@
Quantum.Client.Menu = {}
local libs = {
["net"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_network.lua",
["page"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_pages.lua"
["page"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_pages.lua",
["theme"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_theme.lua"
}
Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end

@ -0,0 +1,36 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
local theme ={}
local scale = Quantum.Client.ResolutionScale
local padding = 10 * scale
local padding_s = 4 * scale
function theme.panel( p, color )
local w, h = p:GetSize()
local clr = color || Color( 0, 0, 0, 100 )
local bclr = Color( 50, 50, 50, 105 )
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
end
function theme.button( b, color )
local w, h = b:GetSize()
local clr = color || Color( 225, 44, 52, 255 )
local bclr = Color( 50, 50, 50, 255 )
if( b:IsHovered() ) then
bclr = Color( 205, 205, 205, 255 )
else
bclr = Color( 50, 50, 50, 255 )
end
draw.RoundedBox( 6, 0, 0, w, h, bclr ) -- border
draw.RoundedBox( 4, padding_s/2, padding_s/2, w - padding_s, h - padding_s, clr ) -- inner
end
return theme

@ -9,6 +9,7 @@ local menu = {}
local net = Quantum.Client.Menu.GetAPI( "net" )
local page = Quantum.Client.Menu.GetAPI( "page" )
local theme = Quantum.Client.Menu.GetAPI( "theme" )
local resScale = Quantum.Client.ResolutionScale
local sw, sh = ScrW(), ScrH()
@ -19,22 +20,23 @@ local pages = {
charSelect = function( parent )
local args = {
CloseButtonText = "Quit",
CloseButtonFont = "q_text2",
CloseButtonFont = "q_text2"
}
local p, c = page.New( parent, args )
local clist = vgui.Create( "DPanel", p )
clist:SetSize( 380 * resScale, sh - padding*15 )
clist.w, clist.h = clist:GetSize()
clist:SetPos( (sw - clist.w) - padding*2, padding*5 )
clist:SetPos( (sw - clist.w) - padding*2, padding*6 )
clist.x, clist.y = clist:GetPos()
clist.Paint = function( self, w, h )
draw.RoundedBox( 6, 0, 0, w, h, Color( 0, 0, 0, 200 ) )
theme.panel( self, Color( 0, 0, 0, 200 ) )
end
--- Close/quit button stuff ---
local cW, cH = c:GetSize()
c:SetPos( clist.x, clist.y + clist.h + cH )
c:SetPos( (clist.x + clist.w) - cW, clist.y + clist.h + cH )
c.Paint = function( self ) theme.button( self ) end
c.DoClick = function() parent:Close() end
---
@ -50,7 +52,7 @@ local pages = {
local chars = {
{name="Vernull", lvl=81},
{name="Devoe", lvl=22},
{name="Leeroy", lvl=2},
{name="Leeroy", lvl=2}
}
local cpanels = {}
for k, v in pairs( chars ) do

Loading…
Cancel
Save