diff --git a/gamemode/engine/core/client/cl_fonts.lua b/gamemode/engine/core/client/cl_fonts.lua index 7b9f9e7..802c9d0 100644 --- a/gamemode/engine/core/client/cl_fonts.lua +++ b/gamemode/engine/core/client/cl_fonts.lua @@ -30,6 +30,12 @@ surface.CreateFont( "q_button", { antialias = true }) +surface.CreateFont( "q_button_m", { + font = "Arial", + size = 30 * Quantum.Client.ResolutionScale, + antialias = true +}) + surface.CreateFont( "q_button2", { font = "Arial", size = 35 * Quantum.Client.ResolutionScale, diff --git a/gamemode/engine/derma/menus/menu_character.lua b/gamemode/engine/derma/menus/menu_character.lua index 95dc6a7..2826dc6 100644 --- a/gamemode/engine/derma/menus/menu_character.lua +++ b/gamemode/engine/derma/menus/menu_character.lua @@ -33,28 +33,19 @@ local function renderSelectedButton( b, sel ) end end -local function renderModelIcons( modelsButtons, parent ) - local modelCount = 0 - for id, model in pairs( getClassModels( inputs.class )[inputs.gender] ) do - modelCount = modelCount + 1 - modelsButtons[modelCount] = vgui.Create( "SpawnIcon", parent ) - modelsButtons[modelCount].index = modelCount - modelsButtons[modelCount]:SetSize( 100 * resScale, 100 * resScale ) - modelsButtons[modelCount].w, modelsButtons[modelCount].h = modelsButtons[modelCount]:GetSize() - modelsButtons[modelCount]:SetPos( 0, modelsButtons[modelCount].h * (modelCount-1) ) - modelsButtons[modelCount]:SetModel( model ) - modelsButtons[modelCount].model = model - -- modelsButtons[modelCount].Paint = function( self ) - -- theme.sharpbutton( self, Color( 0, 0, 0, 0 ) ) - -- end - modelsButtons[modelCount].Think = function( self ) -- a bit inefficient but it works - print( getClassModels( inputs.class )[inputs.gender][self.index], self.model ) - -- set the new models - if( getClassModels( inputs.class )[inputs.gender][self.index] ~= self.model ) then - print( "###:" ,getClassModels( inputs.class )[inputs.gender][modelCount] ) - self:SetModel( getClassModels( inputs.class )[inputs.gender][modelCount] || errorMdl ) - end - end +local function getNextIndex( index, isNext, min, max ) + if( isNext ) then + if( index + 1 > max ) then + return min -- integer overflow LUL + else + return index + 1 + end + else + if( index - 1 < min ) then -- integer underflow + return max + else + return index - 1 + end end end @@ -106,6 +97,7 @@ local pages = { mdl:SetSize( 600 * resScale, 1000 * resScale ) mdl.w, mdl.h = mdl:GetSize() mdl:SetPos( p.w/2 - mdl.w/2, p.h/2 - mdl.h/2 ) + mdl.x, mdl.y = mdl:GetPos() mdl:SetFOV( 55 ) function mdl:LayoutEntity( ent ) return end @@ -117,7 +109,8 @@ local pages = { } local name = vgui.Create( "DTextEntry", p ) - name:SetText( "" ) + name:SetPlaceholderText( "Character Name" ) + name:SetPlaceholderColor( Color( 100, 100, 100, 100 ) ) name:SetFont( "q_button2" ) name:SetTextColor( Color( 255, 255, 255, 255 ) ) name:SetSize( 300 * resScale, 40 * resScale ) @@ -218,6 +211,33 @@ local pages = { end --- Model selector --- + local pmodel = vgui.Create( "DButton", p ) -- previous model + pmodel:SetText( "< Prev. Model" ) + pmodel:SetFont( "q_button_m" ) + pmodel:SetTextColor( Color( 255, 255, 255, 255 ) ) + pmodel:SizeToContents() + pmodel.w, pmodel.h = pmodel:GetSize() + pmodel:SetPos( (mdl.x - pmodel.w) + padding*10, (mdl.y + mdl.h/2) - pmodel.h/2 ) + pmodel.Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 100 ) ) end + pmodel.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + inputs.modelIndex = getNextIndex( inputs.modelIndex, false, 1, #getClassModels( inputs.class )[inputs.gender] ) + end + + local nmodel = vgui.Create( "DButton", p ) -- next model + nmodel:SetText( "Next Model >" ) + nmodel:SetFont( "q_button_m" ) + nmodel:SetTextColor( Color( 255, 255, 255, 255 ) ) + nmodel:SetSize( pmodel.w, pmodel.h ) + nmodel.w, nmodel.h = nmodel:GetSize() + nmodel:SetPos( (mdl.x + mdl.w) - padding*10, (mdl.y + mdl.h/2) - nmodel.h/2 ) + nmodel.Paint = function( self ) theme.sharpbutton( self, Color( 0, 0, 0, 100 ) ) end + nmodel.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + inputs.modelIndex = getNextIndex( inputs.modelIndex, true, 1, #getClassModels( inputs.class )[inputs.gender] ) + end + + -- Class info -- local mscroll = vgui.Create( "DScrollPanel", ip ) mscroll:SetSize( ip.w, ip.h/1.6 ) mscroll.w, mscroll.h = mscroll:GetSize()