diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index cfd9e79..f3f46bf 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -8,7 +8,7 @@ if CLIENT then include( "shared.lua" ) Quantum.Client = {} - Quantum.Client.ResolutionScale = ScrW() / 1080 + Quantum.Client.ResolutionScale = ScrH() / 1080 local function loadCoreFiles() local fol = GM.FolderName .. "/gamemode/engine/core/" diff --git a/gamemode/engine/core/client/cl_fonts.lua b/gamemode/engine/core/client/cl_fonts.lua index c08cada..da94eed 100644 --- a/gamemode/engine/core/client/cl_fonts.lua +++ b/gamemode/engine/core/client/cl_fonts.lua @@ -7,7 +7,13 @@ surface.CreateFont( "q_HUD", { font = "Arial", - size = 15 * Quantum.Client.ResolutionScale, + size = 38 * Quantum.Client.ResolutionScale, antialias = true, outline = true +}) + +surface.CreateFont( "q_text", { + font = "Arial", + size = 22 * Quantum.Client.ResolutionScale, + antialias = true }) \ No newline at end of file diff --git a/gamemode/engine/core/client/cl_hud.lua b/gamemode/engine/core/client/cl_hud.lua index a589e93..f47bdca 100644 --- a/gamemode/engine/core/client/cl_hud.lua +++ b/gamemode/engine/core/client/cl_hud.lua @@ -15,9 +15,9 @@ hook.Add( "HUDShouldDraw", "Quantum_RemoveDefualtHUD", function( hudid ) end) local scale = Quantum.Client.ResolutionScale -local barW, barH = 250 * scale, 10 * scale +local barW, barH = 400 * scale, 25 * scale local radius = 1 * scale -local padding = 2 * scale +local padding = 5 * scale local sw, sh = ScrW(), ScrH() function GM:HUDPaint() diff --git a/gamemode/engine/derma/cl_menu.lua b/gamemode/engine/derma/cl_menu.lua index afaeed5..62693f3 100644 --- a/gamemode/engine/derma/cl_menu.lua +++ b/gamemode/engine/derma/cl_menu.lua @@ -8,7 +8,7 @@ Quantum.Client.Menu = {} local libs = { ["net"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_network.lua", - ["page"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_page.lua" + ["page"] = GM.FolderName .. "/gamemode/engine/derma/lib/cl_menu_pages.lua" } Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end diff --git a/gamemode/engine/derma/lib/cl_menu_pages.lua b/gamemode/engine/derma/lib/cl_menu_pages.lua index bf261f8..356ccb3 100644 --- a/gamemode/engine/derma/lib/cl_menu_pages.lua +++ b/gamemode/engine/derma/lib/cl_menu_pages.lua @@ -7,16 +7,22 @@ local page = {} local scale = Quantum.Client.ResolutionScale - -function page.New( args ) - - args.w, args.h = args.w, args.h || ScrW(), ScrH() - args.x, args.y = args.x, args.y || 0, 0 - - args.closeW, args.closeH = args.closeW, args.closeH || 50 * scale, 20 * scale - args.closeX, args.closeY = args.closeX, args.closeY || args.closeW, args.closeH - - local p = vgui.Create( "DPanel", args.parent ) +local padding = 10 * scale +local padding_s = 4 * scale + +function page.New( parent, args ) + + -- check the vars + args.w, args.h = parent:GetSize() + args.x, args.y = 0, 0 + + args.closeW = args.closeW || 90 * scale + args.closeH = args.closeH || 20 * scale + args.closeX = args.closeX || padding + args.closeY = args.closeY || padding + -- + + local p = vgui.Create( "DPanel", parent ) p.w, p.h = args.w, args.h p.x, p.y = args.x, args.y @@ -28,15 +34,20 @@ function page.New( args ) p.OnClose = args.OnClose || function() end local close = vgui.Create( "DButton", p ) + close:SetText( args.CloseButtonText || "Close" ) + close:SetTextColor( args.CloseButtonTextColor || Color( 0, 0, 0, 255 ) ) + close:SetFont( args.CloseButtonFont || "q_text" ) close:SetSize( args.closeW, args.closeH ) close:SetPos( args.closeX, args.closeY ) - close.DoClick = function() p:Close() end - close.Paint = args.CloseButtonPaint || function( self, w, h ) - surface.SetDrawColor( 255, 60, 60, 255 ) + close.DoClick = function() p:Remove() end + close.Paint = args.CloseButtonPaint || function( self, w, h ) + surface.SetDrawColor( 50, 50, 50, 255 ) surface.DrawRect( 0, 0, w, h ) - end - return p + surface.SetDrawColor( 235, 64, 52, 255 ) + surface.DrawRect( padding_s/2, padding_s/2, w - padding_s/2, h - padding_s/2 ) + end + return p, close end return page \ 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 f3ffd51..980abe9 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -11,17 +11,17 @@ local net = Quantum.Client.Menu.GetAPI( "net" ) local page = Quantum.Client.Menu.GetAPI( "page" ) local resScale = Quantum.Client.ResolutionScale +local sw, sh = ScrW(), ScrH() +local padding = 10 * resScale + local pages = { - charSelect = function() + charSelect = function( parent ) local args = { - CloseButtonPaint = function( self, w, h ) - surface.SetDrawColor( 100, 100, 100, 255 ) - surface.DrawRect( 0, 0, w, h ) - end, - OnClose = function() print("close test") end + CloseButtonText = "Back", + CloseButtonFont = "q_text", } - local p = page.New( args ) + local p, c = page.New( parent, args ) local clist = vgui.Create( "DPanel", p ) clist:SetSize( 200 * resScale, sh - padding*10 ) @@ -32,13 +32,26 @@ local pages = { surface.DrawRect( 0, 0, w, h ) end + return p + end, + charCreate = function( parent ) + local pW, pH = parent:GetSize() + local args = { + CloseButtonText = "Return", + CloseButtonFont = "q_text", + } + local p, c = page.New( parent, args ) + + c:SetSize( 85 * resScale, 25 * resScale ) + local closeW, closeH = c:GetSize() + c:SetPos( padding*4, (pH - closeH) - padding*4 ) + return p end } function menu.open( dt ) - local sw, sh = ScrW(), ScrH() - local padding = 10 * resScale + if( !f ) then local f = vgui.Create( "DFrame" ) f:SetTitle( "Character Menu" ) @@ -47,27 +60,10 @@ function menu.open( dt ) surface.SetDrawColor( 0, 0, 0, 190 ) surface.DrawRect( 0, 0, w, h ) end + f:IsDraggable( false ) f:MakePopup() - pages.charSelect() -- test - - - - -- local txt = vgui.Create( "DTextEntry", f ) - -- txt:SetText( "Enter name here" ) - -- txt:SetSize( 250, 25 ) - -- local txtW, txtH = txt:GetSize() - -- txt:SetPos( sw/2 - txtW/2, sh/2 - txtH/2 ) - -- local txtX, txtY = txt:GetPos() - - -- local b = vgui.Create( "DButton", f ) - -- b:SetText( "Create Char" ) - -- b:SizeToContents() - -- local bW, bH = b:GetSize() - -- b:SetPos( sw/2 - bW/2, txtY - bH ) - -- b.DoClick = function() - -- net.RunNetworkedFunc( "createChar", { name = txt:GetValue() } ) - -- end + local char = pages.charCreate( f ) -- test end end