diff --git a/gamemode/engine/derma/cl_menu.lua b/gamemode/engine/derma/cl_menu.lua index 62693f3..b980005 100644 --- a/gamemode/engine/derma/cl_menu.lua +++ b/gamemode/engine/derma/cl_menu.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 diff --git a/gamemode/engine/derma/lib/cl_menu_theme.lua b/gamemode/engine/derma/lib/cl_menu_theme.lua new file mode 100644 index 0000000..0514d6a --- /dev/null +++ b/gamemode/engine/derma/lib/cl_menu_theme.lua @@ -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 \ No newline at end of file diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 9f78350..ad456c6 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -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