Character menu stuff & page api stuff

master
AlmTech 5 years ago
parent a255824202
commit acc5b071a6
  1. 3
      gamemode/engine/derma/cl_menu.lua
  2. 6
      gamemode/engine/derma/lib/cl_menu_pages.lua
  3. 35
      gamemode/engine/derma/menus/menu_character.lua

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

@ -13,6 +13,9 @@ 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 )
p.w, p.h = args.w, args.h
p.x, p.y = args.x, args.y
@ -25,7 +28,8 @@ function page.New( args )
p.OnClose = args.OnClose || function() end
local close = vgui.Create( "DButton", p )
close:SetSize( 50 * scale, 20 * scale )
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 )

@ -8,11 +8,32 @@
local menu = {}
local net = Quantum.Client.Menu.GetAPI( "net" )
local page = Quantum.Client.Menu.GetAPI( "page" )
local resScale = Quantum.Client.ResolutionScale
local panels = {
[1] = function( parent, args ) end
local pages = {
charSelect = function()
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
}
local p = page.New( args )
local clist = vgui.Create( "DPanel", p )
clist:SetSize( 200 * resScale, sh - padding*10 )
clist.w, clist.h = clist:GetSize()
clist:SetPos( (sw - clist.w) - padding*2, sh/2 - clist.h/2 )
clist.Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 200 )
surface.DrawRect( 0, 0, w, h )
end
return p
end
}
function menu.open( dt )
@ -28,15 +49,9 @@ function menu.open( dt )
end
f:MakePopup()
pages.charSelect() -- test
local clist = vgui.Create( "DPanel", f )
clist:SetSize( 200 * resScale, sh - padding*10 )
clist.w, clist.h = clist:GetSize()
clist:SetPos( (sw - clist.w) - padding*2, sh/2 - clist.h/2 )
clist.Paint = function( self, w, h )
surface.SetDrawColor( 0, 0, 0, 200 )
surface.DrawRect( 0, 0, w, h )
end
-- local txt = vgui.Create( "DTextEntry", f )
-- txt:SetText( "Enter name here" )

Loading…
Cancel
Save