Import the project from the library screen, items in the demo folders are optional
Drag the .YYMP file onto the workspace area of your project. Items in the demo folders are optional
At the beginning of you game, run this code
Now run your game, you should see a menu appear.
EzMenu comes with many scripts to easily add stuff to your menu.
See the scripts under Scripts->EzMenu->Menu
Simply call these menu_add_* scripts to add elements to your menu.
EzMenu offers a decent amount of customization right out of the box, the configuration script is located at Scripts->EzMenu->EzMenuConfig
You may also wish to create your own component draw scripts or modify the existing ones located at Scripts->EzMenu->Component->draw This will help EzMenu fit your game's aesthetic.
You can add your own components. See the menu_add_* scripts under Scripts->EzMenu->Menu to see some examples.
Let’s create an image button that will link to another menu. Let’s create an empty script called "menu_add_button_image_link"
Since EzMenu already contains a text button (Scripts->EzMenu->menu->menu_add_button_text_link) have a look at the code for that to get an idea of what we’ll be creating.
We need 3 things for our image button.
The index is used for gamepads to know which element to go to next as well as some internal logic for selecting menu elements.
If a component has an index of -1, it can not be selected. Since out image button will need to be clicked, we need to give each one a unique index. Like the text button, we will make this the first parameter for our script
Our image button will need a sprite, let’s make that the second parameter and then the scale as the third
With this info, we can work out the size for the component on the menu
The next thing we’ll need is the menu to link to. This will be our next parameter.
Now onto the most important part, creating our component.
A component is made up of an array with specific information
EzMenu comes with a script to draw a sprite as a menu element, it’s under Scripts->EzMenu->component->draw and it’s called "draw_component_sprite"
We can simply use that in our component array.
Next we need our activate script, once again, EzMenu comes with one of these that will open another menu. Scripts->EzMenu-component->activate. It’s called "activate_component_link"
Now we’re just missing one thing, our script inputs. Opening up draw_component_sprite, we see that it needs two inputs, the sprite & scale. We’ll add theseas an array to our component array like so:
Next, the inputs for activate_component_link, opening that script shows it simple needs a menu name to open. Let’s add it
Now we have our component completed, we can add it to our menu.
All together, it should look something like this:
Now to test our component.
Go to your menu initialization point and test it out! Here’s an example:
If all is well, you should have two different menus with image buttons on them!
You can create your own draw_ or activate_ scripts as well, look at the default EzMenu scripts for inspiration and explanation.
Components ALL have a draw script attached to them, this is what draws them onto the menu. You can use the built-in scripts or create you own.
The built-in draw scripts are located at EzMenu->Component->Draw, look at or modify these to learn more about how they work.
Every component is passed the following parameters at draw time:
Every component has an "activate" script that is fired when an input is pressed while a component is selected.
There are 5 types of input, defined via the eInputType enum.
EzMenu comes equipped with a basic menu animation system. By default, a slide animation is applied when you change menus.
To create your own menu animation, create a child of parMenuAnimator and mark it persistent.
To set your animator object as the animation used, open up the EzMenuConfiguration script and change the value of MENU_ANIMATOR to your animator object.
See the oMenuAnimatorSlide to see how it works.
EzMenu contains some scripts that allow you to store the state of components, this is used in Sliders, checkboxes, selectors, etc.
This data is not saved between sessions. If you wish to serialize the data, it is stored in a globalds_map called global.component_values .
To save data to the storage system:
To retrieve it:
There are some helper methods located at Scripts->EzMeniu->Component->data to make handling of more complex components easier.
This system is not intended to be a perfect solution, you may wish to engineer your own.
EzMenu has an easy to change input system that you can change or modify to fit into your game.
Open up the oMenus object located at Objects->EzMenu and open the "Begin Step" method.
In here you will see the checks for user input, simply change these to suit your needs.
EzMenu also offers a simple solution to switch between Keyboard/Mouse input to controller input, this is located in the same place. Modify this to your needs.