mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Adds proper documentation and explains some of the navigation/menu usage behavior via the BaseUI example menus
This commit is contained in:
parent
41add628ad
commit
07b3e2789e
6 changed files with 260 additions and 5 deletions
|
|
@ -5,17 +5,44 @@ function MainMenuGui::onAdd(%this)
|
|||
|
||||
function MainMenuGui::onWake(%this)
|
||||
{
|
||||
//In the BaseUI example case, the MainMenuGUI acts as our background
|
||||
//So it's a logical control to set as our UINavigation as well. So we
|
||||
//set the MainMenuGUI's superClass to UINavigation to integrate it into
|
||||
//that namespace to open up page navigation
|
||||
|
||||
//At the same time, the MainMenuGUI control has the button holder, set to
|
||||
//the MenuInputButtonContainer class, allowing us to set it as the active button
|
||||
//holder here, prepping it for catching any button inputs to active commands
|
||||
//Specifically, it sets the $activeMenuButtonContainer to be this, which allows
|
||||
//other controls to manage what the behavior of the buttons is consistently
|
||||
//without needing to worry about hardcoded names
|
||||
MainMenuButtonHolder.setActive();
|
||||
|
||||
//We also have the MainMenuInputHandler, a GuiInputCtrl with the MenuInputHandler class
|
||||
//This allows us to catch any input/axis event and pass it along to the active menuList
|
||||
//or button containers to navigate the menus
|
||||
//We set up this catch by making said control our first responder, here
|
||||
MainMenuInputHandler.setFirstResponder();
|
||||
|
||||
//Lastly, we go ahead and display some actual navigable content up on our main menu here
|
||||
//In this case, we set the MainMenuButtonList as our root page, so we always come back
|
||||
//to having the main menu buttons on screen if every other page is closed.
|
||||
//This will ultimately call MainMenuButtonList::onOpen(), so to see where the navigation
|
||||
//chain continues, see that function.
|
||||
%this.setRootPage(MainMenuButtonList);
|
||||
|
||||
//We also go ahead and mark for any future pages being added to the UINavigation's page stack
|
||||
//to be prompted to resize when added. This isn't required, but helps keep pages formated to
|
||||
//the current size of the UINavigation, which is useful when dealing with aspect ratio or resolution
|
||||
//changes.
|
||||
%this.resizePages = true;
|
||||
}
|
||||
|
||||
function MainMenuButtonHolder::onWake(%this)
|
||||
{
|
||||
//clean slate
|
||||
//Because the blan slate MainMenuGUI doesn't have anything we need to bother with inputs on
|
||||
//we just go ahead and disable all the buttons in our MainMenuButtonHolder to have
|
||||
// a clean slate
|
||||
%this-->button1.disable();
|
||||
%this-->button2.disable();
|
||||
%this-->button3.disable();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue