From 8d2f3bdb6fac0dba5c4bf4c622bf4f7e950b6adc Mon Sep 17 00:00:00 2001 From: LiddulBOFH <13317534+LiddulBOFH@users.noreply.github.com> Date: Sat, 25 May 2024 21:49:35 -0500 Subject: [PATCH] Start of a new menu New tab at the top of the spawnmenu labeled ACF Potentially the new main menu (or even synchronized with the main ACF tool) --- lua/acf/menu/tabmenu_cl.lua | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 lua/acf/menu/tabmenu_cl.lua diff --git a/lua/acf/menu/tabmenu_cl.lua b/lua/acf/menu/tabmenu_cl.lua new file mode 100644 index 000000000..4096dd6ce --- /dev/null +++ b/lua/acf/menu/tabmenu_cl.lua @@ -0,0 +1,81 @@ +local ACF = ACF + +local function BaseMenu(Parent) + local ctrl = vgui.Create("Panel",Parent) + Parent.Base = ctrl + ctrl:Dock(FILL) + ctrl:DockMargin(6,6,6,6) + + ctrl.Paint = function(_, w, h) + surface.SetDrawColor(65,65,65) + surface.DrawRect(0,0,w,h) + + return true + end + + --[[ + local LeftBase = vgui.Create("DTree") + local RightBase = vgui.Create("Panel") + RightBase.Paint = function(_, w, h) + surface.SetDrawColor(127,65,65) + surface.DrawRect(0,0,w,h) + + return true + end + + local ToolBar = vgui.Create("Panel", RightBase) + ToolBar:SetSize(1,120) + ToolBar:SetMouseInputEnabled(true) + ToolBar:DockMargin(0,0,0,6) + ToolBar:Dock(TOP) + ToolBar.SampleMouse = function(self, x) + if not self:IsHovered() then return false end + -- LocalCursorPos + end + ToolBar.Paint = function(self, w, h) + local RidgeWidth = math.min(w - 200, 400) + surface.SetDrawColor(65,65,127) + draw.NoTexture() + local Poly = { + {x = 0, y = 0}, + {x = RidgeWidth + 100, y = 0}, + {x = RidgeWidth, y = h}, + {x = 0, y = h} + } + surface.DrawRect(0,0,w,40) + surface.DrawPoly(Poly) + + + return true + end + + local Divider = vgui.Create("DHorizontalDivider", ctrl) + Divider:Dock(FILL) + Divider:SetLeftWidth(300) + Divider:SetLeft(LeftBase) + Divider:SetRight(RightBase) + ]]-- + + return ctrl +end +local function Regenerate(Panel) + Panel.Base:Remove() + BaseMenu(Panel) +end + +spawnmenu.AddCreationTab("ACF", function() + local Menu_BasePanel = vgui.Create("Panel") + Menu_BasePanel.Paint = function() return true end + + BaseMenu(Menu_BasePanel) + + ACF.TabMenu = Menu_BasePanel + + return Menu_BasePanel +end, "icon16/cog.png", 15) + +concommand.Add("acf_reload_tab_menu", function() + if not IsValid(ACF.TabMenu) then return end + + Regenerate(ACF.TabMenu) +end) \ No newline at end of file