-
Notifications
You must be signed in to change notification settings - Fork 0
CustomMenu
nhmkdev edited this page Jan 15, 2014
·
6 revisions
The Custom Menu system is used for accessing other custom menus and or game modes via a standard interface. The custom menu system uses the Modestack.
A menu is the following:
- Title text (optional)
- List of options (optional)
- Selector (icon or character)
- Windows (optional)
TODO: consider merging CustomMenu and Dialog
var Menus = ig.global.data.menus;
Notes
- The customMenuSampleSettingsBase is an optional separate object for easy reuse across dialog objects. All fields indicated in the customMenuSampleSettingsBase object are applicable to the 's' object of a dialog.
var customMenuSampleSettingsBase =
{
x:50, // target x (default: 0)
y:20, // target y (default: 0)
ys:20, // y space between items (default: 10)
w:true, // wrap on menu down/up on first/last item (default: false)
ab:false, // allow backup (previous menu) (default: true)
f: '04b03.font', // font ('media/' is prepended and '.png' is appended)
// menu selection can be indicated with a graphic OR a character
// selection character
mc: '=', // menu char (default: '>')
// selection icon
micn:'slime-grenade', // icon ('media/' is prepended and '.png' is appended)
micna:
{
sx:0, // source x (default: 0)
sy:0, // source y (default: 0)
w:8, // width (default: image width)
h:8 // height (default: image height)
},
}
Menus.sample =
{
s: // settings for the menu
{
base:customMenuSampleSettingsBase , // base settings
ys:30 // sample override of a value in base
},
mi: // menu items array
[
{
t: "Start Game", // text
// specify either a game mode or another custom menu when the user selects
g:'MainGame', // game mode
// OR
m:'mainMenu' // custom menu 'ig.support.global.menus.' is prepended
},
]
};
Any time you need open a menu (remember the custom menu is a game mode):
// Support.custommenu.data is a special variable for assigning menu data for use with CustomMenu
Support.custommenu.data = Menus.mainMenu;
ig.system.setGame(CustomMenu);