Creating a main menu
Now that we have a basic understanding of the UI flowgraph implementation, let's get started with creating our very own main menu.
Creating menu elements
The first thing we need to do is create our UI element definition in order to provide the engine with a means for loading our exported SWF file.
To do so, create a new XML document in Game/Libs/UI/UIElements/
named MainMenuSample.xml
. The bare minimum code required for our menu can be seen in the following code:
<UIElements name="Menus"> <UIElement name="MainMenuSample" mouseevents="1" keyevents="1" cursor="1" controller_input="1"> <GFx file="MainMenuSample.swf" layer="3"> <Constraints> <Align mode="dynamic" halign="left" valign="top" scale="1" max="1"/> </Constraints> </GFx> </UIElement> </UIElements>
With the previous code present, the engine will know where to load our SWF file, and how to align it on the screen.
Note
SWF files can be...