The main menu (fl_main_menu): a fullscreen panel with a sidebar of buttons and at most one submenu open at a time. The buttons are added with add_button from the AddMainMenuItems hook; a button either runs a callback or opens a theme panel as the submenu. The theme draws the menu and supplies its music.

Summary

Methods

Adds a button to the sidebar.
Init()client
Covers the screen, builds the sidebar and starts the theme's menu music unless the framework runs in development mode.
Shows a notification near the bottom of the menu unless one is already visible.
Restores the blur update rate that was lowered while the menu was open.
Opens a theme panel as the submenu, closing the currently open submenu first.
Draws the menu through the theme's PaintMainMenu hook.
Recreates the sidebar, optionally filling it through the AddMainMenuItems hook.
Think()client
Animates the schema logo offset toward zero while a submenu is open and back otherwise.
Slides the open submenu away and closes it, bringing the sidebar back in.

Methods

PANEL:add_button(text, callback)

client plugins/characters/plugin/views/cl_main_menu.lua:184

Adds a button to the sidebar.

Parameters

  • text String button title, displayed in upper case
  • callback Function/String function that receives the clicked button, or the ID of a theme panel to open as the submenu

Returns

  • Panel the created button

Covers the screen, builds the sidebar and starts the theme's menu music unless the framework runs in development mode.

Shows a notification near the bottom of the menu unless one is already visible.

Parameters

  • text String

Restores the blur update rate that was lowered while the menu was open.

PANEL:OpenMenu(panel, data)

client plugins/characters/plugin/views/cl_main_menu.lua:105

Opens a theme panel as the submenu, closing the currently open submenu first.

Parameters

  • panel String theme panel ID
  • data Any optional, defaults to nil passed to the set_data method of the new panel, if it has one

Draws the menu through the theme's PaintMainMenu hook.

Parameters

  • w Number
  • h Number

PANEL:RecreateSidebar(create_buttons)

client plugins/characters/plugin/views/cl_main_menu.lua:73

Recreates the sidebar, optionally filling it through the AddMainMenuItems hook.

Parameters

  • create_buttons Boolean optional, defaults to false add the menu buttons and center them

Animates the schema logo offset toward zero while a submenu is open and back otherwise.

PANEL:to_main_menu(from_right)

client plugins/characters/plugin/views/cl_main_menu.lua:126

Slides the open submenu away and closes it, bringing the sidebar back in.

Parameters

  • from_right Boolean optional, defaults to false bring the sidebar in from the right instead of the left

Defined in