openplanet Download Openplanet Login with ManiaPlanet

Menu options

It's possible for plugins to add menu options and even show custom windows on the overlay. To start showing menu options, you need to add a second global function to your plugin:

void RenderMenu()
{
}

This function is always called each frame to render the menu, and therefore can not be yielded. To show a menu option here, we use the UI::MenuItem function. The UI functions work as an immediate mode GUI, so in this case, the MenuItem function will return true or false based on whether it was clicked that frame or not. So, we can write the following code to create a simple menu item:

void RenderMenu()
{
  if (UI::MenuItem("My first menu item!")) {
    print("You clicked me!!");
  }
}

That will look like this:

For more information on what other UI functions there are, see the UI documentation.

For information on which specific function declarations will be called by Openplanet, see plugin functions.

Continue to the next page: The app object