Menu options

Plugins have the ability to add menu options and display custom windows on the overlay. To start showing menu options, you need to add the RenderMenu() function to your plugin:

void RenderMenu()
{
}

This function is called every frame to render the menu, and 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

Created 278 days ago by