From 9de566ddaeb8a56825012f23967421fa27c0781a Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Sun, 17 Nov 2019 00:13:02 +0100 Subject: [PATCH] Front end for main menu done --- gamemode/engine/core/client/cl_fonts.lua | 12 ++ .../engine/derma/lib/cl_menu_areusure.lua | 15 ++ gamemode/engine/derma/menus/menu_main.lua | 147 ++++++++++++++++++ gamemode/settings/sh_settings.lua | 1 + gamemode/shared.lua | 1 + 5 files changed, 176 insertions(+) create mode 100644 gamemode/engine/derma/lib/cl_menu_areusure.lua diff --git a/gamemode/engine/core/client/cl_fonts.lua b/gamemode/engine/core/client/cl_fonts.lua index 76065fb..8f3c272 100644 --- a/gamemode/engine/core/client/cl_fonts.lua +++ b/gamemode/engine/core/client/cl_fonts.lua @@ -65,4 +65,16 @@ surface.CreateFont( "q_header_s", { font = "Constantia Bold Italic", size = 42 * Quantum.Client.ResolutionScale, antialias = true +}) + +surface.CreateFont( "q_title", { + font = "Cambria Bold", + size = 60 * Quantum.Client.ResolutionScale, + antialias = true +}) + +surface.CreateFont( "q_subtitle", { + font = "Cambria Bold", + size = 38 * Quantum.Client.ResolutionScale, + antialias = true }) \ No newline at end of file diff --git a/gamemode/engine/derma/lib/cl_menu_areusure.lua b/gamemode/engine/derma/lib/cl_menu_areusure.lua new file mode 100644 index 0000000..60d1310 --- /dev/null +++ b/gamemode/engine/derma/lib/cl_menu_areusure.lua @@ -0,0 +1,15 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + +local sure = {} + +function sure.openSureBox( text, parent, func ) + local p = vgui.Create( "DPanel", parent ) + p:SetSize( 100, 100 ) +end + +return sure \ No newline at end of file diff --git a/gamemode/engine/derma/menus/menu_main.lua b/gamemode/engine/derma/menus/menu_main.lua index 859c8be..851f2a0 100644 --- a/gamemode/engine/derma/menus/menu_main.lua +++ b/gamemode/engine/derma/menus/menu_main.lua @@ -56,6 +56,11 @@ function main.open(dt) local padding = 10 * resScale local padding_s = 4 * resScale + local buttonWidth = 255 * resScale + local buttonColor = Color( 20, 20, 20, 100 ) + local buttonTextColor = Color( 255, 255, 255, 255 ) + local buttonFont = "q_button2" + local f = vgui.Create( "DFrame" ) f:SetSize( sw, sh ) f:SetTitle( "" ) @@ -71,6 +76,148 @@ function main.open(dt) Quantum.Client.Cam.Start( scenes[ game.GetMap() ][math.random( 1, table.Count(scenes[ game.GetMap() ])) ], false ) + local version = vgui.Create( "DLabel", f ) + version:SetText( "Quantum Version: " .. Quantum.Version ) + version:SetFont( "q_text2" ) + version:SetTextColor( Color( 255, 255, 255, 80 ) ) + version:SizeToContents() + version.w, version.h = version:GetSize() + version:SetPos( padding, padding ) + + local title = vgui.Create( "DLabel", f ) + title:SetText( Quantum.ServerTitle || "[ERROR COULD NOT FIND TITLE]" ) + title:SetFont( "q_title" ) + title:SetTextColor( Color( 255, 255, 255, 225 ) ) + title:SizeToContents() + title.w, title.h = title:GetSize() + title:SetPos( sw/2 - title.w/2, sh/5 - title.h/2 ) + title.x, title.y = title:GetPos() + + local sub = vgui.Create( "DLabel", f ) + sub:SetText( "Run by Quantum, created by AlmTech" ) + sub:SetFont( "q_subtitle" ) + sub:SetTextColor( Color( 255, 255, 255, 150 ) ) + sub:SizeToContents() + sub.w, sub.h = sub:GetSize() + sub:SetPos( sw/2 - sub.w/2, title.y + sub.h + padding*2.25 ) + sub.x, sub.y = sub:GetPos() + + + ---- BUTTONS ---- + + -- play button + local play = vgui.Create( "DButton", f ) + play:SetText( "Play" ) + play:SetFont( buttonFont ) + play:SetTextColor( buttonTextColor ) + + play:SizeToContents() + play.w, play.h = play:GetSize() + play:SetSize( buttonWidth, play.h ) + play.w, play.h = play:GetSize() + + play:SetPos( sw/2 - play.w/2, sub.y + play.h + padding*20 ) + play.x, play.y = play:GetPos() + + play.Paint = function( self ) + theme.sharpbutton( self, buttonColor ) + end + + play.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + f:Close() + end + play.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + + -- Settings button + local settings = vgui.Create( "DButton", f ) + settings:SetText( "Settings" ) + settings:SetFont( buttonFont ) + settings:SetTextColor( buttonTextColor ) + + settings:SizeToContents() + settings.w, settings.h = settings:GetSize() + settings:SetSize( buttonWidth, settings.h ) + settings.w, settings.h = settings:GetSize() + + settings:SetPos( sw/2 - settings.w/2, play.y + settings.h + padding*2 ) + settings.x, settings.y = settings:GetPos() + + settings.Paint = function( self ) + theme.sharpbutton( self, buttonColor ) + end + settings.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + end + settings.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + + -- Workshop button + local ws = vgui.Create( "DButton", f ) + ws:SetText( "Steam Workshop" ) + ws:SetFont( buttonFont ) + ws:SetTextColor( buttonTextColor ) + + ws:SizeToContents() + ws.w, ws.h = ws:GetSize() + ws:SetSize( buttonWidth, ws.h ) + ws.w, ws.h = ws:GetSize() + + ws:SetPos( sw/2 - ws.w/2, settings.y + ws.h + padding*2 ) + ws.x, ws.y = ws:GetPos() + + ws.Paint = function( self ) + theme.sharpbutton( self, buttonColor ) + end + ws.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + end + ws.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + + -- Discord server invite button + local inv = vgui.Create( "DButton", f ) + inv:SetText( "Discord Invite" ) + inv:SetFont( buttonFont ) + inv:SetTextColor( buttonTextColor ) + + inv:SizeToContents() + inv.w, inv.h = inv:GetSize() + inv:SetSize( buttonWidth, inv.h ) + inv.w, inv.h = inv:GetSize() + + inv:SetPos( sw/2 - inv.w/2, ws.y + inv.h + padding*2 ) + inv.x, inv.y = inv:GetPos() + + inv.Paint = function( self ) + theme.sharpbutton( self, buttonColor ) + end + inv.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + end + inv.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + + -- Quit button + local quit = vgui.Create( "DButton", f ) + quit:SetText( "Disconnect" ) + quit:SetFont( buttonFont ) + quit:SetTextColor( buttonTextColor ) + + quit:SizeToContents() + quit.w, quit.h = quit:GetSize() + quit:SetSize( buttonWidth, quit.h ) + quit.w, quit.h = quit:GetSize() + + quit:SetPos( sw/2 - quit.w/2, inv.y + quit.h + padding*2 ) + quit.x, quit.y = quit:GetPos() + + quit.Paint = function( self ) + theme.sharpbutton( self, buttonColor ) + end + quit.DoClick = function( self ) + surface.PlaySound( "UI/buttonclick.wav" ) + LocalPlayer():ConCommand("disconnect") + end + quit.OnCursorEntered = function() surface.PlaySound( "UI/buttonrollover.wav" ) end + end end diff --git a/gamemode/settings/sh_settings.lua b/gamemode/settings/sh_settings.lua index 5729fbd..d51cde0 100644 --- a/gamemode/settings/sh_settings.lua +++ b/gamemode/settings/sh_settings.lua @@ -6,6 +6,7 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ Quantum.CharacterLimit = 5 +Quantum.ServerTitle = "Electron Networks: CityRP" Quantum.Models = { NPC = {}, diff --git a/gamemode/shared.lua b/gamemode/shared.lua index ecfca58..b99bad3 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -11,6 +11,7 @@ GM.Email = "elias@almtech.se" GM.Website = "N/A" Quantum = {} +Quantum.Version = "v0.1-alpha" include( "engine/sh_debug.lua" ) -- add the debug functions and stuff