Updated button theme

master
AlmTech Software 5 years ago
parent 1c06462838
commit bb5e719c89
  1. 6
      gamemode/engine/core/client/cl_fonts.lua
  2. 10
      gamemode/engine/derma/lib/cl_menu_theme.lua
  3. 39
      gamemode/engine/derma/menus/menu_main.lua

@ -42,6 +42,12 @@ surface.CreateFont( "q_button2", {
antialias = true antialias = true
}) })
surface.CreateFont( "q_button_l", {
font = "Arial",
size = 45 * Quantum.Client.ResolutionScale,
antialias = true
})
surface.CreateFont( "q_charNameText", { surface.CreateFont( "q_charNameText", {
font = "Arial", font = "Arial",
outline = true, outline = true,

@ -238,7 +238,7 @@ function theme.fadepanelborder( p, dir, color, color2, startalpha, intervall )
end end
end end
function theme.fadebutton( b, dir, inColor ) function theme.fadebutton( b, dir, inColor, font, txtColor )
local w, h = b:GetSize() local w, h = b:GetSize()
local brdColor = Color( 0, 0, 0 ) local brdColor = Color( 0, 0, 0 )
inColor = inColor || Color( 0, 0, 0, 100 ) inColor = inColor || Color( 0, 0, 0, 100 )
@ -250,6 +250,14 @@ function theme.fadebutton( b, dir, inColor )
end end
theme.fadepanelborder( b, dir, Color( brdColor.r * 0.4, brdColor.g * 0.4, brdColor.b * 0.4 ) , brdColor ) theme.fadepanelborder( b, dir, Color( brdColor.r * 0.4, brdColor.g * 0.4, brdColor.b * 0.4 ) , brdColor )
-- render the text
local txt = b.txt || "ERROR txt=nil"
surface.SetFont( font || "Default" )
surface.SetTextColor( txtColor || Color( 255, 255, 255, 255 ) )
local tw, th = surface.GetTextSize( txt )
surface.SetTextPos( w/8, h/2 - th/2 )
surface.DrawText( txt )
end end
---- Color Manipulation ---- ---- Color Manipulation ----

@ -74,7 +74,7 @@ function main.open(dt)
local buttonWidth = 400 * resScale local buttonWidth = 400 * resScale
local buttonColor = Color( 20, 20, 20, 180 ) local buttonColor = Color( 20, 20, 20, 180 )
local buttonTextColor = Color( 255, 255, 255, 255 ) local buttonTextColor = Color( 255, 255, 255, 255 )
local buttonFont = "q_button2" local buttonFont = "q_button_l"
local f = vgui.Create( "DFrame" ) local f = vgui.Create( "DFrame" )
f:SetSize( sw, sh ) f:SetSize( sw, sh )
@ -141,15 +141,14 @@ function main.open(dt)
local ybasepos = sh*0.775 - padding*20 local ybasepos = sh*0.775 - padding*20
local ypos = ybasepos local ypos = ybasepos
local contBtnAlign = 5 local contBtnAlign = 4
-- resume button -- resume button
if( dt.cont.resume ) then if( dt.cont.resume ) then
local res = vgui.Create( "DButton", f ) local res = vgui.Create( "DButton", f )
res:SetText( "Resume Game" ) res:SetText( "Resume Game" )
res:SetFont( buttonFont ) res.txt = "Resume Game"
res:SetTextColor( buttonTextColor )
res:SizeToContents() res:SizeToContents()
res.w, res.h = res:GetSize() res.w, res.h = res:GetSize()
@ -162,7 +161,7 @@ function main.open(dt)
res.Paint = function( self ) res.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
-- theme.fadebutton( self, 1, Color( 90, 90, 240 ) ) -- theme.fadebutton( self, 1, Color( 90, 90, 240 ) )
theme.fadebutton( self, 1 ) theme.fadebutton( self, 1, nil, buttonFont, buttonTextColor )
end end
res.DoClick = function( self ) res.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
@ -179,11 +178,15 @@ function main.open(dt)
-- play button -- play button
local play = vgui.Create( "DButton", f ) local play = vgui.Create( "DButton", f )
play:SetText( "Play" ) play:SetText( "" ) -- why cant we just set the texts posistion :(
play:SetFont( buttonFont ) play.txt = "Play"
play:SizeToContents() play:SizeToContents()
play.w, play.h = play:GetSize() play.w, play.h = play:GetSize()
surface.SetFont( buttonFont )
play.w, play.h = surface.GetTextSize( "AAAAA" )
play:SetSize( buttonWidth, play.h ) play:SetSize( buttonWidth, play.h )
play.w, play.h = play:GetSize() play.w, play.h = play:GetSize()
@ -201,7 +204,7 @@ function main.open(dt)
play.Paint = function( self ) play.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 ) theme.fadebutton( self, 1, nil, buttonFont, buttonTextColor )
end end
play.DoClick = function( self ) play.DoClick = function( self )
@ -216,7 +219,8 @@ function main.open(dt)
-- Settings button -- Settings button
local settings = vgui.Create( "DButton", f ) local settings = vgui.Create( "DButton", f )
settings:SetText( "Settings" ) settings:SetText( "" )
settings.txt = "Settings"
settings:SetFont( buttonFont ) settings:SetFont( buttonFont )
settings:SetTextColor( buttonTextColor ) settings:SetTextColor( buttonTextColor )
@ -230,7 +234,7 @@ function main.open(dt)
settings.Paint = function( self ) settings.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 ) theme.fadebutton( self, 1, nil, buttonFont, buttonTextColor )
end end
settings.DoClick = function( self ) settings.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
@ -242,7 +246,8 @@ function main.open(dt)
-- Workshop button -- Workshop button
local ws = vgui.Create( "DButton", f ) local ws = vgui.Create( "DButton", f )
ws:SetText( "Steam Workshop" ) ws:SetText( "" )
ws.txt = "Steam Workshop"
ws:SetFont( buttonFont ) ws:SetFont( buttonFont )
ws:SetTextColor( buttonTextColor ) ws:SetTextColor( buttonTextColor )
@ -256,7 +261,7 @@ function main.open(dt)
ws.Paint = function( self ) ws.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 ) theme.fadebutton( self, 1, nil, buttonFont, buttonTextColor )
end end
ws.DoClick = function( self ) ws.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
@ -269,7 +274,8 @@ function main.open(dt)
-- Discord server invite button -- Discord server invite button
local inv = vgui.Create( "DButton", f ) local inv = vgui.Create( "DButton", f )
inv:SetText( "Discord Invite" ) inv:SetText( "" )
inv.txt = "Discord Invite"
inv:SetFont( buttonFont ) inv:SetFont( buttonFont )
inv:SetTextColor( buttonTextColor ) inv:SetTextColor( buttonTextColor )
@ -283,7 +289,7 @@ function main.open(dt)
inv.Paint = function( self ) inv.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 ) theme.fadebutton( self, 1, nil, buttonFont, buttonTextColor )
end end
inv.DoClick = function( self ) inv.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )
@ -296,7 +302,8 @@ function main.open(dt)
-- Quit button -- Quit button
local quit = vgui.Create( "DButton", f ) local quit = vgui.Create( "DButton", f )
quit:SetText( "Disconnect" ) quit:SetText( "" )
quit.txt = "Disconnect"
quit:SetFont( buttonFont ) quit:SetFont( buttonFont )
quit:SetTextColor( buttonTextColor ) quit:SetTextColor( buttonTextColor )
@ -310,7 +317,7 @@ function main.open(dt)
quit.Paint = function( self ) quit.Paint = function( self )
--theme.sharpbutton( self, buttonColor ) --theme.sharpbutton( self, buttonColor )
theme.fadebutton( self, 1 ) theme.fadebutton( self, 1, nil, buttonFont, buttonTextColor )
end end
quit.DoClick = function( self ) quit.DoClick = function( self )
surface.PlaySound( "UI/buttonclick.wav" ) surface.PlaySound( "UI/buttonclick.wav" )

Loading…
Cancel
Save