Skip to content

Commit

Permalink
Start of a new menu
Browse files Browse the repository at this point in the history
New tab at the top of the spawnmenu labeled ACF
Potentially the new main menu (or even synchronized with the main ACF tool)
  • Loading branch information
LiddulBOFH committed May 26, 2024
1 parent 64aa800 commit 8d2f3bd
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions lua/acf/menu/tabmenu_cl.lua
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 8d2f3bd

Please sign in to comment.