From ZDoom Wiki
Jump to navigation Jump to search

Menu is the base class for all menus within GZDoom and must be inherited from to create a custom menu. It comes with its own unique form of input handling that overrides all gameplay input and gives more precise mouse functionality. It's recommended that one of its appropriate child classes be inherited from if specific menu type functionality is desired, but this can be inherited from if a clean slate is needed. It contains all functionality for overriding actions allowing for total customization of how the menu acts. The Screen API can be referred to for how to render text and images onto the screen. The DTA_CleanNoMove and DTA_CleanNoMove_1 flags are commonly used for drawing here.

See option menus for creating menus with modifiable values and list menus for creating simple lists. For creating custom image scrollers, see image scrollers. If trying to create custom save and load menus, see save menus.

Menu Names

Menus often come with two components: the menu itself and a descriptor. The descriptor is generated by the MENUDEF file and stores generic information about the menu so that it can be created. Some menus have hardcoded MENUDEF names within the engine that forces special interactions. The menu names listed below have internal behavior tied to them and should be used when trying to emulate their behaviors (or avoided if not).

General Menus

  • MainMenu
  • MainMenuTextOnly
  • EpisodeMenu
  • This menu will automatically populate the item list with episode information
  • PlayerclassMenu
  • This menu will automatically populate the item list with the player classes
  • SkillMenu
  • This menu will automatically populate the item list with skill information

Control Menus

  • CustomizeControls
  • MouseOptions
  • JoystickOptions
  • JoystickOptionsDefaults
  • This menu must be present in order for JoystickOptions to work

Sound Menus

  • SoundOptions
  • ModReplayerOptions
  • AdvSoundOptions
  • GusConfigMenu
  • WildMidiConfigMenu
  • TimidityConfigMenu
  • FluidPatchsetMenu
  • ADLMIDICustomBanksMenu
  • OPNMIDICustomBanksMenu
  • ADLBankMenu

Option Menus

  • OptionsMenu
  • OptionsMenuSimple
  • OptionsMenuFull
  • GameplayOptions
  • CompatibilityOptions
  • MessageOptions
  • AutomapOptions
  • MapColorMenu
  • ScoreboardOptions
  • VideoOptions
  • VideoModeMenu

Misc Menus

  • StartgameConfirm
  • Startgame
  • StartgameConfirmed
  • SavegameMenu
  • LoadgameMenu
  • PlayerMenu
  • NewPlayerMenu
  • ReadThisMenu
  • QuitMenu
  • EndgameMenu


  • Menu mParentMenu - Setting this marks the menu as a sub-menu. The parent is the menu that this one entered from. This is normally set by Init()
  • bool mMouseCapture - If set to true, the menu will capture the mouse. This should be set with SetCapture()
  • bool mBackbuttonSelected - If set to true, the back button normally in the top left corner of the menu is currently being hovered
  • bool DontDim - If set to true, the background isn't dimmed while the menu is active
  • bool DontBlur - If set to true, the background isn't blurred while the menu is active
  • bool AnimatedTransition - If set to true, this menu supports animated transitions between menus that also have this set
  • bool Animated - If set to true, this menu should be updated in real time and not every game tic



  • int MenuTime()
  • Menu GetCurrentMenu()
  • clearscope void SetMenu(Name mnu, int param = 0)
  • void StartMessage(string msg, int mode = 0, Name command = 'None')
  • void SetMouseCapture(bool on)
  • void MenuSound(Name snd)
  • Font OptionFont()
  • int OptionHeight()
  • int OptionWidth(string s)
  • void DrawOptionText(int x, int y, int color, string text, bool grayed = false)


  • bool MenuEvent(int mkey, bool fromcontroller)
  • bool OnUIEvent(UIEvent ev)
  • bool OnInputEvent(InputEvent ev)
  • void Drawer()
  • bool TranslateKeyboardEvents()
  • void SetFocus(MenuItemBase fc)
  • bool CheckFocus(MenuItemBase fc)
  • void ReleaseFocus()
  • void ResetColor()
  • bool MouseEvent(int type, int mx, int my)
  • void Ticker()
  • void OnReturn()


  • void Init(Menu parent)
  • void Close()
  • void ActivateMenu()
  • void SetCapture(bool on)
  • protected bool MouseEventBack(int type, int x, int y)

Menu Items

MenuItemBase is the base class for all items that might need to be stored within a subclass menu e.g. an element in a list menu. They offer very little functionality by default.


  • protected double mXpos - The current x position of the menu item. Can be set from SetX() to allow for more customized behavior
  • protected double mYpos - The current y position of the menu item. Can be set from SetY() to allow for more customized behavior
  • protected Name mAction - The name of the action to perform when Activate() is called. Usually this is a menu name that creates a new menu of that type. Generally set by Init()
  • int mEnabled - If true, the menu item is currently enabled. Can be set from Enable() to allow for more customized behavior

Virtual Methods

  • bool CheckCoordinate(int x, int y)
  • void Ticker()
  • void Drawer(bool selected)
  • bool Selectable()
  • bool Activate()
  • Name, int GetAction()
  • bool SetString(int i, string s)
  • bool, string GetString(int i)
  • bool SetValue(int i, int value)
  • bool, int GetValue(int i)
  • void Enable(bool on)
  • bool MenuEvent(int mkey, bool fromcontroller)
  • bool MouseEvent(int type, int x, int y)
  • bool CheckHotkey(int c)
  • int GetWidth()
  • int GetIndent()
  • int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
  • void OnMenuCreated()

Non-static Methods

  • void Init(double xpos = 0, double ypos = 0, Name actionname = 'None')
  • void OffsetPositionY(double ydelta)
  • double GetY()
  • double GetX()
  • void SetX(double x)
  • void SetY(double x)

Menu Descriptors

MenuDescriptor is the internal class that stores information about a menu from the MENUDEF file.


  • Name mMenuName - The name given to the menu in the MENUDEF file
  • string mNetgameMessage - The message to display if this option shouldn't be allowed when playing online. This is set with the NetgameMessage keyword in MENUDEF
  • class<Menu> mClass - The class type the menu was specified as in the MENUDEF file

Static Methods

  • MenuDescriptor GetDescriptor(Name n)

Generic Menus

GenericMenu is a subclass of Menu and is used to create menus that aren't defined in MENUDEF. If a menu isn't given a name via MENUDEF then it has to inherit from this class, otherwise it won't work. The only major change this class offers is that its Init() function is overrideable. If your menu is going to be defined in a MENUDEF file then it should inherit from the standard Menu classes.

Virtual Methods

  • void Init(Menu parent)

Menu Delegates

MenuDelegateBase is a class that allows hooking into and overriding certain menu functions, similar to an event handler. It can be specified in the GameInfo block of MAPINFO. All delegates must inherit from this class.

Virtual Methods

  • int DrawCaption(string title, Font fnt, int y, bool drawit)
  • void PlaySound(Name sound)
  • bool DrawSelector(ListMenuDescriptor desc)
  • void MenuDismissed()
  • Font PickFont(Font fnt)