MSD UI Documentation

MSD (MacNCo Simple Design) is the UI library shared by addons such as MQS and MRS. It gives you ready-made menu elements, a layout list, drawing helpers, a config that is synced from the server, and a language system. This page covers the settings and every public function.


Installation

  1. Put the msd_ui folder in garrysmod/addons/.
  2. Restart the server. The console prints [MSD] Initialization done when it has loaded.
  3. Open the settings from the context menu (C) with the Setup Menu icon.

Only one copy of MSD can be loaded. If another addon ships a different version, the console prints [MSD] Another version of MSD detacted and the second copy is skipped.


Settings

Settings are stored on the server in data/msd_data/config.txt and sent to every player. Only super admins can change them, using Upload changes in the settings menu. Reset changes restores the values the menu was opened with.

Key Type Default Description
MSD.Config.Language string "en" Language id, a file name from lua/msd/language/
MSD.Config.Rounded number 8 Corner radius in px. 0 is square, the slider goes from 4 to 20
MSD.Config.Blur boolean false Blurred menu background instead of a solid color
MSD.Config.Vignette boolean false Vignette flag, read by modules that support it
MSD.Config.BgrColor Color 45, 45, 45 Menu background color
MSD.Config.ThemeColor Color 0, 5, 10 Tint of the translucent panels (MSD.Theme d, m, l)
MSD.Config.MSDX boolean true true draws with the MSDX shaders, false with stock draw.RoundedBox
MSD.Config.UISounds boolean true Click, enter and toggle sounds
MSD.Config.SoundsVolume number 0.3 UI sound volume, from 0 to 1
MSD.Config.MainColor table see below p main color, r red, rd dark red (errors)
MSD.Config.HUD table HUD settings used by modules that draw a HUD

Shadows, MSD.DrawBlur and MSD.DrawBlurCircle are shader only. With MSDX off they draw nothing. Use MSD.Blur or MSD.BlurPanel when the blur is needed in both modes.


Theme colors

These tables are read every frame, so they can be used directly in Paint functions.

Table Keys Use
MSD.Theme d, m, l, d_na Dark, medium and light translucent panels; d_na is the opaque menu color
MSD.Text a, n, d, s, m, l Text colors from dimmed (n) to white (l)
MSD.Config.MainColor p, r, rd Main color and error reds
MSD.Clr red, red_dark, green, blue_dark Fixed status colors
MSD.ColorPresets 1 - 8 Swatches shown in the color picker

Use MSD.MainShade to get lighter or darker versions of the main color instead of hard-coding them.


Layout

Most element functions take parent, x, y, w, h and work in two modes.

  • List mode: x = "static", y = nil. The element is added to an MSDPanelList and sized by the list.
    • w is a divider of the list width: 1 full width, 2 half, 3 a third, and so on.
    • w as a string takes the rest of the row: "3" is the width minus a third.
    • h is a fixed height in px.
  • Free mode: x and y are numbers. The element is placed in parent at that position with the size w x h.
local list = vgui.Create("MSDPanelList", frame)
list:SetSize(400, 300)
list:EnableVerticalScrollbar()
list:EnableHorizontal(true)
list:SetSpacing(2)

MSD.Header(list, "Settings")
MSD.Button(list, "static", nil, 2, 50, "Left", function() end)
MSD.Button(list, "static", nil, 2, 50, "Right", function() end)
MSD.Button(frame, 10, 320, 200, 40, "Free placed", function() end)

Custom panels can use the same system by setting panel.StaticScale = { w = 1, fixed_h = 50, minw = 50, minh = 50 } before list:AddItem(panel).


Languages

Languages live in lua/msd/language/<id>.lua and are loaded automatically. A missing phrase falls back to English, and a missing English phrase returns the key itself.

-- lua/msd/language/pl.lua
MSD.Language["pl"] = {
    lang_name = "Polski",
    ok = "OK",
    time_sec = "%s sek.",
}

Addons can add their own phrases to an existing language:

MSD.Language["en"]["my_addon_title"] = "My addon"

Modules

Addons add a tab to the MSD setup menu with MSD.AddModule.

MSD.AddModule("My addon", function(canvas, menu)
    local list = vgui.Create("MSDPanelList", canvas)
    list:SetSize(canvas:GetWide(), canvas:GetTall())
    list:EnableVerticalScrollbar()
    list:EnableHorizontal(true)

    MSD.Header(list, "My addon settings")
end, MSD.Icons48.cog)

Core

MSD.AddModule

Shared MSD.AddModule( string name, function menu, IMaterial icon )

Description

Adds or replaces a tab in the MSD setup menu.

Arguments

  1. string name | Tab name, also the module id
  2. function menu | Builds the tab: function(canvas, mainPanel)
  3. IMaterial icon | Tab icon

Returns

  1. number | Module id

MSD.OpenMenuManager

Client MSD.OpenMenuManager( Panel parent, number module )

Description

Opens the MSD setup menu. Does nothing for players without MSD.AdminAccess.

Arguments

  1. Panel parent | Optional parent, for example g_ContextMenu
  2. number module | Optional module id to open first

Returns

  1. Panel | The menu frame

MSD.AdminAccess

Client MSD.AdminAccess( Player ply )

Description

Checks if a player can open the setup menu. Uses MQS editors or MRS administrators when those addons are installed, otherwise super admins.

Returns

  1. boolean | Has access

MSD.SaveConfig

Shared MSD.SaveConfig()

Description

On the client, sends MSD.Config to the server (super admins only). On the server, saves the config to data/msd_data/config.txt and sends it to all players.


MSD.GetPhrase

Shared MSD.GetPhrase( string key, any ... )

Description

Returns a phrase in the selected language. Extra arguments are passed to string.format.

Returns

  1. string | The phrase, or the key when it is missing

Example

local Ln = MSD.GetPhrase
print(Ln("time_sec", 30)) -- "30 sec."

MSD.GetAvatar

Shared MSD.GetAvatar( string steamid64 )

Description

Returns the Steam avatar image url of a player. The first call starts the request and returns an empty string until the url is loaded.

Returns

  1. string | Avatar url or ""

MSD:Icon

Client MSD:Icon( string name )

Description

Returns an icon from MSD.Icons48 by name, or a fallback material when the icon is missing. All icons can be copied from the MSD Icons 48 list in the settings menu.

Returns

  1. IMaterial | Icon material

string.subUTF8

Shared string.subUTF8( string text, number start, number end )

Description

string.sub that counts UTF-8 characters instead of bytes, so Cyrillic and other non-Latin text is not cut in half. Negative indexes count from the end.

Returns

  1. string | Part of the text

Colors

MSD.ColorAlpha

Client MSD.ColorAlpha( Color color, number alpha )

Description

Returns a copy of the color with a new alpha.


MSD.CrossColor

Client MSD.CrossColor( number t, Color from, Color to )

Description

Blends two colors by t (0 - 1). Use it for hover animations instead of drawing twice with opposite alphas. Returns the input color itself when t is 0 or 1.

Example

self.alpha = Lerp(FrameTime() * 5, self.alpha, self:IsHovered() and 1 or 0)
draw.DrawText("Hello", "MSDFont.22", 5, 5, MSD.CrossColor(self.alpha, MSD.Text.s, MSD.Config.MainColor.p))

MSD.ColorShade

Client MSD.ColorShade( Color color, number level )

Description

Returns a lighter or darker version of a color. Results are cached.

Arguments

  1. Color color | Base color
  2. number level | 5 the color itself, 4 - 1 lighter, 6 - 9 darker

Returns

  1. Color | Shaded color

MSD.MainShade

Client MSD.MainShade( number level )

Description

MSD.ColorShade of the main color (MSD.Config.MainColor.p).

Example

MSDX.Draw(0, 0, h - 5, w, 5, MSD.MainShade(8))      -- dark track
MSDX.Draw(0, 0, h - 5, w * progress, 5, MSD.MainShade(5)) -- main color fill

MSD.ApplyTheme

Client MSD.ApplyTheme()

Description

Rebuilds MSD.Theme d, m and l from MSD.Config.ThemeColor. Called automatically when the config is received and when the panel color is changed.


Drawing

MSD.UseMSDX

Client MSD.UseMSDX()

Description

Checks if the MSDX shaders are used: the MSDX setting is on and the game runs on DirectX 9 or newer.

Returns

  1. boolean | Shaders are used

MSDX.Draw

Client MSDX.Draw( number radius, number x, number y, number w, number h, Color color, number flags )

Description

Draws a rounded box. Replaces draw.RoundedBox and follows the MSDX setting. Sizes of 0 or less draw nothing.

Arguments

  1. number radius | Corner radius, usually MSD.Config.Rounded
  2. number x, y, w, h | Box position and size
  3. Color color | Box color
  4. number flags | Optional corner flags: MSDX.NO_TL, MSDX.NO_TR, MSDX.NO_BL, MSDX.NO_BR

Example

-- only the top corners are rounded
MSDX.Draw(8, 0, 0, w, 40, MSD.Theme.d, MSDX.NO_BL + MSDX.NO_BR)

MSDX.DrawOutlined

Client MSDX.DrawOutlined( number radius, number x, number y, number w, number h, Color color, number thickness, number flags )

Description

Draws a box outline. Without MSDX the outline is square.


MSDX.DrawCircle

Client MSDX.DrawCircle( number x, number y, number diameter, Color color )

Description

Draws a filled circle centred on x, y.


MSD.DrawArc

Client MSD.DrawArc( number x, number y, number diameter, number from, number to, Color color, number thickness )

Description

Draws an arc on the edge of a circle centred on x, y, thickness px wide inwards. Angles are in degrees, 0 is right and they go clockwise. Works with MSDX on and off.

Example

-- progress ring
MSD.DrawArc(w / 2, h / 2, 64, 0, 360 * progress, MSD.Config.MainColor.p, 4)

MSD.CornerFlags

Client MSD.CornerFlags( boolean tl, boolean tr, boolean bl, boolean br )

Description

Turns draw.RoundedBoxEx corner booleans into MSDX flags.

Returns

  1. number | Flags for MSDX.Draw

MSD.DrawBG

Client MSD.DrawBG( Panel panel, number w, number h )

Description

Draws the menu background from the settings: blur or the background color.


MSD.DrawTexturedRect

Client MSD.DrawTexturedRect( number x, number y, number w, number h, IMaterial material, Color color )

Description

Draws a material. material can also be a path string; the material is created once and cached. A missing material is skipped.


MSD.DrawTexturedRectRotated

Client MSD.DrawTexturedRectRotated( number rotation, number x, number y, number w, number h, IMaterial material, Color color )

Description

Draws a rotated material centred on x, y. MSD.DrawTexturedRectOfRot takes the same arguments with x, y as the top left corner.


MSD.DrawTexturedOutlined

Client MSD.DrawTexturedOutlined( number x, number y, number w, number h, IMaterial material, Color color, number outline, Color outlineColor )

Description

Draws a material with an outline around it.


MSD.ShadowText

Client MSD.ShadowText( string text, string font, number x, number y, Color color, number align, number offset, Color shadowColor )

Description

Draws text with a drop shadow. offset defaults to 1 px and shadowColor to black.


MSD.DrawKey

Client MSD.DrawKey( number x, number y, string key, number alpha )

Description

Draws a keyboard key hint, for example E. MSD.DrawKeyIcon(x, y, material, size, alpha) draws the same hint with an icon.

Returns

  1. number | Width of the hint, to place the next element

Blur

MSD.Blur

Client MSD.Blur( Panel panel, number passes, number density, number alpha, number darken, number w, number h )

Description

Blurs the screen behind a panel and darkens it. Works with MSDX on and off. The blur strength is (3 / passes) * density.

Arguments

  1. Panel panel | Panel being painted
  2. number passes, density | Blur strength
  3. number alpha | Blur opacity, 255 is full blur
  4. number darken | Alpha of the black layer drawn on top
  5. number w, h | Area size, usually the panel size

Example

panel.Paint = function(self, w, h)
    MSD.Blur(self, 1, 3, 255, 50, w, h)
end

MSD.BlurPanel

Client MSD.BlurPanel( Panel panel, number strength, number w, number h, number alpha )

Description

Blurs the area behind a panel, or the whole screen behind it when w and h are not given. Works with MSDX on and off.


MSD.DrawBlur

Client MSD.DrawBlur( number x, number y, number w, number h, number strength, number radius, number alpha )

Description

Blurs a rounded rectangle. MSDX only. MSD.DrawBlurCircle(x, y, diameter, strength, alpha) blurs a circle.


Text and time

MSD.TextWrap

Client MSD.TextWrap( string text, string font, number width )

Description

Adds line breaks so the text fits the width. Long words are split.

Returns

  1. string | Wrapped text
  2. number | Width of the last line
  3. number | Total text height

MSD.NiceTime

Client MSD.NiceTime( number seconds )

Description

Returns a short duration in the selected language, for example 45 sec., 2 h. 15 min. or 3 d..

Example

print(MSD.NiceTime(8100)) -- "2 h. 15 min."

Sound

MSD.UISnd

Client MSD.UISnd( string sound )

Description

Plays a UI sound at the volume from the settings. Does nothing when UI sounds are off. MSD elements already call it on click.

Example

MSD.UISnd("msd/ui/click.wav") -- also enter.wav, error.wav, return.wav, toggle.wav

MSD.PlaySnd

Client MSD.PlaySnd( string sound, number volume )

Description

Plays a sound file from sound/, ignoring the UI sound settings.


Utility

MSD.Anim

Client MSD.Anim( number time, string ease )

Description

Creates a simple animation object. Call anim:Start() once and anim:Play() every frame, then read anim.Value. ease is a math.ease function name.

Example

local anim = MSD.Anim(0.3, "OutQuad")
anim:Start()

panel.Paint = function(self, w, h)
    anim:Play()
    MSDX.Draw(8, 0, 0, w * anim.Value, h, MSD.Config.MainColor.p)
end

MSD.ImgLib.GetMaterial

Client MSD.ImgLib.GetMaterial( string url, boolean jpg )

Description

Downloads an image from a url, caches it in data/msd_imgs/ and returns it as a material. Returns MSD.ImgLib.NoMaterial until the download is done.


Elements

Element functions return the created panel. See Layout above for parent, x, y, w, h. Callbacks receive the element as the first argument.

MSD.Header

Client MSD.Header( Panel list, string text, function back, IMaterial icon, boolean alignLeft, function paint )

Description

Full width 50 px title bar for an MSDPanelList. When back is set, a back button is drawn on the left with icon (default arrow). paint(self, w, h) draws extra content.


MSD.InfoHeader

Client MSD.InfoHeader( Panel list, string text, number w )

Description

Small 25 px section title.


MSD.InfoText

Client MSD.InfoText( Panel list, string text, string font )

Description

Wrapped text block that grows to fit its text.


MSD.InfoTextIcon

Client MSD.InfoTextIcon( Panel list, string title, string text, IMaterial icon, Color iconColor )

Description

Text block with a 64 px icon and a title in the main color. Also available: MSD.InfoTextF1(list, text, wide, font) for plain help text, and MSD.InfoTextButton(list, text, wide, func, font) for clickable text.


MSD.PanelIcon

Client MSD.PanelIcon( Panel list, string text, IMaterial icon, function paint )

Description

50 px info row with an icon. paint(self, w, h) is called every frame to draw extra content.


MSD.Button

Client MSD.Button( Panel parent, any x, number y, number w, number h, string text, function func, boolean alignLeft )

Description

Standard button with an underline that turns to the main color on hover. Set button.disabled = true to disable it, button.bg to change its background.

Example

MSD.Button(list, "static", nil, 1, 50, MSD.GetPhrase("ok"), function(self)
    print("clicked")
end)

MSD.ButtonIcon

Client MSD.ButtonIcon( Panel parent, any x, number y, number w, number h, string text, IMaterial icon, function func, function rightClick, Color color, Color hoverColor, function paint )

Description

Button with an icon on the left. Without func it is a static row. paint(self, w, h) draws extra content behind the text.


MSD.ButtonIconText

Client MSD.ButtonIconText( Panel parent, any x, number y, number w, number h, string text, string rightText, IMaterial icon, function func, function rightClick, Color color )

Description

MSD.ButtonIcon with a second text aligned to the right, for example a value or price. Set button.text to change it.


MSD.ButtonSimple

Client MSD.ButtonSimple( Panel parent, any x, number y, number w, number h, string text, number fontSize, function func )

Description

Text-only button. Set button.Check = function() return true end to draw it as selected.


MSD.ButtonScr

Client MSD.ButtonScr( Panel parent, any x, number y, number w, number h, string text, function func, boolean alignLeft, string workshopId )

Description

Square tile button with a centred title. With workshopId the addon preview image is downloaded and used as the background.


MSD.BigButton

Client MSD.BigButton( Panel parent, any x, number y, number w, number h, string text, IMaterial icon, function func, Color hoverColor, string id, function rightClick, string bottomText, function paint )

Description

Large tile with a 48 px icon and a title. id is shown in the top left corner, bottomText at the bottom. Set button.disable = true to disable it. MSD.BigButtonClean is the same tile without a background.


MSD.BigModelButton

Client MSD.BigModelButton( Panel parent, any x, number y, number w, number h, string text, IMaterial icon, function func, string text2, boolean centerText, Color hoverColor, function rightClick )

Description

MSD.BigButton that can show a model. Call panel.SetCustomModel(model) to replace the icon with the model.


MSD.IconButton

Client MSD.IconButton( Panel parent, IMaterial icon, any x, number y, number size, Color color, Color hoverColor, function func, function paint )

Description

Square icon button. Change button.mat to swap the icon. paint(self, w, h) draws a background.

Example

local close = MSD.IconButton(frame, MSD.Icons48.cross, frame:GetWide() - 34, 10, 25, nil, MSD.Config.MainColor.p, function()
    frame:Close()
end)

MSD.IconButtonText

Client MSD.IconButtonText( Panel parent, string text, IMaterial icon, any x, number y, number size, Color color, Color hoverColor, function func )

Description

Icon button with wrapped text under the icon, like a file in a file browser.


MSD.IconButtonBG

Client MSD.IconButtonBG( Panel parent, IMaterial icon, number x, number y, number size, Color color, Color hoverColor, function func )

Description

Icon button on a dark background that fills with the main color on hover.


MSD.CloseButtonIcon

Client MSD.CloseButtonIcon( Panel parent, any x, number y, number w, number h, string text, function func, IMaterial icon )

Description

Text with a close icon on the right that turns red on hover.


MSD.MenuButton

Client MSD.MenuButton( Panel parent, IMaterial icon, number x, number y, number w, number h, string text, function func, function rightClick, boolean smallIcon )

Description

Side menu button. Set button.hovered = true to mark it as selected. MSD.MenuButtonTop is the top bar version; pass "auto" as w to size it to its text.


MSD.TextEntry

Client MSD.TextEntry( Panel parent, any x, number y, number w, number h, string placeholder, string label, string value, function func, boolean onType, boolean onFocusLost, boolean multiline, boolean numeric )

Description

Text field. func(self, value) runs on Enter, on every change when onType is set, and when the field loses focus when onFocusLost is set. Set entry.error = "text" to show a red error in place of the label.

Example

MSD.TextEntry(list, "static", nil, 1, 50, "Type a name...", "Name:", "", function(self, value)
    print(value)
end, true)

MSD.NumberWang

Client MSD.NumberWang( Panel parent, any x, number y, number w, number h, number min, number max, number value, string label, function func )

Description

Number field with a min and max. func(self) runs when the value changes.


MSD.VectorDisplay

Client MSD.VectorDisplay( Panel parent, any x, number y, number w, number h, string label, Vector vector, function func )

Description

Shows a vector and opens x, y, z fields on click. func(vector, self) runs on change. MSD.AngleDisplay does the same for an Angle.


MSD.VectorSelectorList

Client MSD.VectorSelectorList( Panel list, string label, Vector vector, boolean showAngle, Angle angle, string angleLabel, boolean copyButtons, function func )

Description

Position picker for an MSDPanelList: a vector field, an optional angle field, and buttons to copy your position, aim position or the aimed entity. func(vector, angle) runs on change.


MSD.Binder

Client MSD.Binder( Panel parent, any x, number y, number w, number h, string text, number key, function func )

Description

Key binder. func(key) receives the new KEY_ enum. Mouse buttons are not accepted.


MSD.BoolSlider

Client MSD.BoolSlider( Panel parent, any x, number y, number w, number h, string text, boolean value, function func )

Description

On / off switch. func(self, value) runs on toggle. Set switch.disabled = true to lock it.


MSD.DTextSlider

Client MSD.DTextSlider( Panel parent, any x, number y, number w, number h, string textOn, string textOff, boolean value, function func )

Description

Switch between two options. The label shows textOn or textOff for the current state.

Example

MSD.DTextSlider(list, "static", nil, 1, 50, "Rounded", "Square", MSD.Config.Rounded > 0, function(self, value)
    MSD.Config.Rounded = value and 8 or 0
end)

MSD.VolumeSlider

Client MSD.VolumeSlider( Panel parent, any x, number y, number w, number h, string text, number value, function func, Color color, function format )

Description

Click slider from 0 to 1. func(self, value) runs on change. format(value) returns the value label; the default is a percentage. MSD.VolumeScale takes the same arguments and goes from 0 to 2.

Example

MSD.VolumeSlider(list, "static", nil, 1, 50, "Radius", 0.25, function(self, value)
    MSD.Config.Rounded = math.Round(4 + value * 16)
end, nil, function(value)
    return math.Round(4 + value * 16) .. " px"
end)

MSD.ComboBox

Client MSD.ComboBox( Panel parent, any x, number y, number w, number h, string label, string value )

Description

Dropdown in MSD style. Use the standard DComboBox functions: AddChoice, SetValue and OnSelect.

Example

local combo = MSD.ComboBox(list, "static", nil, 1, 50, "Language:", MSD.GetPhrase("lang_name"))

for id, lang in pairs(MSD.Language) do
    combo:AddChoice(lang.lang_name, id)
end

combo.OnSelect = function(self, index, text, id)
    MSD.Config.Language = id
end

MSD.ColorSelector

Client MSD.ColorSelector( Panel parent, any x, number y, number w, number h, string text, Color color, function func, boolean alpha )

Description

Row with a color swatch that opens a color picker with RGB fields and presets. func(self, color) runs on every change. alpha adds an alpha bar. MSD.ColorSelectBut(parent, x, y, w, h, color, func) is a single swatch button.


MSD.NPCModelFrame

Client MSD.NPCModelFrame( Panel parent, any x, number y, number w, number h, string model, number sequence )

Description

Model preview that can be rotated with the mouse and zoomed with the mouse wheel.


MSD.DropIcon

Client MSD.DropIcon( Panel list, IMaterial material, number size, Color outline, function func )

Description

Square image tile with a colored outline, for item or reward lists.


MSD.WorkSpacePanel

Client MSD.WorkSpacePanel( Panel parent, string title, number w, number h, boolean noFade, boolean opaque )

Description

Blurred overlay over the work space of an MSDSimpleFrame, with a centred window and a title. w and h are dividers of the frame size (default 1.1 and 1.3); the window width stays between 500 and 900 px. Call panel.Close() to fade it out.

Returns

  1. Panel | The overlay
  2. Panel | The window, put your content here

Popups

The popups fill the screen when parent is nil, or the work space of an MSDSimpleFrame when a frame is given.

MSD.AskPopup

Client MSD.AskPopup( Panel parent, string title, boolean noClose, table button1, table button2 )

Description

Question popup with up to two buttons. Each button is { text, function(button) end }. noClose hides the close icon.

Example

MSD.AskPopup(nil, "Delete this quest?", false,
    {"Delete", function() print("deleted") end},
    {"Cancel", function() end}
)

MSD.AskPopupEntr

Client MSD.AskPopupEntr( Panel parent, string title, boolean noClose, table entry )

Description

Popup with a text field. entry is { placeholder, function(textEntry) end }; the function runs on Enter.

Returns

  1. Panel | Popup
  2. Panel | Popup window
  3. Panel | Text field

MSD.AskPopupCombo

Client MSD.AskPopupCombo( Panel parent, string title, boolean noClose, table combo )

Description

Popup with a dropdown and a confirm button. combo is { placeholder, buttonText, function(button) end }. Store the selected value on the button in OnSelect.

Returns

  1. Panel | Dropdown
  2. Panel | Confirm button
  3. Panel | Popup
  4. Panel | Popup window

MSD.AskConfirmPopup

Client MSD.AskConfirmPopup( Panel parent, string question, string acceptText, string cancelText, function accept )

Description

Confirmation popup. The accept button has to be held for 2 seconds, which prevents accidental clicks.


Menus

MSD.MenuOpen

Client MSD.MenuOpen( Panel parentMenu, Panel parent, boolean solid )

Description

Creates a right-click menu in MSD style. Add options with menu:AddOption(text, func, icon, check); the option is skipped when check() returns false. menu:AddSubMenu(text, func, icon) adds a sub menu.

Example

local menu = MSD.MenuOpen(false, button)
menu:AddOption("Edit", function() end, MSD.Icons48.pencil)
menu:AddOption("Remove", function() end, MSD.Icons48.cross)
menu:Open()

Panels

Panel Base Description
MSDSimpleFrame EditablePanel Draggable frame. frame:AddToWorkSpace(panel) fits a panel into its work area
MSDPanelList DPanel Scrolling list with the StaticScale layout. EnableHorizontal, EnableVerticalScrollbar, SetSpacing, SetPadding, AddItem, Clear
MSDModelPanel DButton Model panel with mouse rotation
MSD.DMenu DMenu Menu created by MSD.MenuOpen
MSD.RadialMenu EditablePanel Radial menu, see below
MSDProgressBar Panel Progress bar, see below

MSDPanelList options: set list.IgnoreVbar = true to keep the scrollbar out of the layout, and list.HideVbar = true to hide it.

MSD.RadialMenu

Client vgui.Create( "MSD.RadialMenu" )

Description

Radial menu around the screen centre. Fill panel.actions with { name, func, icon, check } and call panel:Build(). Left click runs the hovered action. The mouse is kept near the centre while the menu is open.

Example

local radial = vgui.Create("MSD.RadialMenu")
radial:SetSize(400, 400)
radial:Center()
radial:MakePopup()

radial.actions = {
    {"Wave", function() RunConsoleCommand("act", "wave") radial:Remove() end, MSD.Icons48.hand_right},
    {"Close", function() radial:Remove() end, MSD.Icons48.cross},
}

radial:Build()

MSDProgressBar

Client vgui.Create( "MSDProgressBar" )

Description

Progress bar with SetMin, SetMax and SetValue. SetAnimated(true) eases the bar to the new value, SetColor(color) changes the bar color (default main color).


Console commands

Command Realm Description
soundviewer Client Sound browser for the game, mounted games and addons. Click a file to play it and copy its path