MenuUI

Updated for BeardLib version 3.38.

MenuUI is a built-in menu system in BeardLib that allows you to make menus that are simpler, faster and better looking than the current menu system PD2 has to offer.

Why was it created?

When I started working on the editor I was in a dilemma on whether to use the in game menu system or make my own thing. The normal menu system(aka MenuNodeGUI) is really limited and old. And, it's far too complex for what it's trying to achieve. Plus, not talking about how unfriendly it is when you want to do something more complex.

What does it offer

  • Simple yet extensive menu system.

  • Text boxes that support copy pasting and have a history table for undo and redo and in general are much more responsive than any input box overkill made.

  • Combo Boxes instead of multi choice.

  • Multiple ways of positioning an item: menu aligning, absolute positions, position strings and position functions.

  • Every item can host items.

The root of your menu. This will take care of events to supply to the items such as mouse movement and keyboard input and to toggle your menu.

You can create the menu almost anytime. However, if you're creating it before managers.gui_data gets initialized you'll have to use the "create_items" value callback so MenuUI can create the items when it's ready.

self._menu = MenuUI:new({
    name = "YourMenuName",
    create_items = callback(self, self, "CreateItems"),
})

Parameters

each value in MenuUI classes gets automatically merged into the class, you can add your own values and even replace core functions if you want! However, be careful, as some values are handled by MenuUI and will change from what you initially gave it when initializing the item.

Basic parameters

Colors/Customization

Functions:

Get

Set

Other

Item creation functions

MenuUI can only build menus (although items can be menus they are still considered "items") Each item creation function takes the params as its first parameter. params is essentially the parameters of the menu.

All items

MenuUI has a few items. Each item can be a menu but menus are always menus. Meaning that items by default are not menus; they don't run any menu events. But, if you add an item to the item it will act like a menu. This is done to have a button inside a button for example. All items inherit the Item class!

Read about Item before reading about any other item. As all items, including menus, inherit it. Most of the menu functions are documented there too.

Last updated