persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
UIMenu Class Referenceabstract

#include <UIMenu.hpp>

Inheritance diagram for UIMenu:
Collaboration diagram for UIMenu:

Public Member Functions

 UIMenu (bool iCustomRender=false)
 Construct a new UIMenu.
virtual void resetMenu ()
 Resets the menu to its initial state.
virtual ViewState updateHook ()
 Optional hook to call during the update loop.
void updateAnimation ()
int selectionOffset () const
int getSelectedOption () const
 Gets the index of the selected option.
int getStartIndex () const
 Gets the index of the first visible option.
etl::span< MenuOption > getOptions () const
 Gets the options of the active menu.
void setVisibleOptions (int count)
 Sets the visible option count of a custom render menu, as UISystem only sets it for the menus it draws.

Protected Member Functions

ViewState changeMenu (etl::span< MenuOption > newOptions)
 Changes the active menu.

Protected Attributes

std::string pauseMessage = "Pause"
bool isActive = false
TextComponent * text = nullptr
etl::span< MenuOption > options
int selectedOption = 0
int startIndex = 0

Private Member Functions

void animateSelection ()
virtual void prevOption ()
 Changes the current options to the previous options.
virtual void resetHook ()=0
 Used to set the default pauseMessage and options values.
virtual void closeHook ()=0
 Execute logic after the root menu is exited.

Private Attributes

int visibleOptions = 0
const bool customRender
etl::stack< MenuState, 5 > prevOptions
ViewState nextViewState = ViewState::KEEP_CURRENT
int selectionX = 0
UIAnimator animator

Friends

class UISystem

Detailed Description

Definition at line 20 of file UIMenu.hpp.

Constructor & Destructor Documentation

◆ UIMenu()

UIMenu::UIMenu ( bool iCustomRender = false)
inline

Construct a new UIMenu.

Parameters
iCustomRenderif a custom render is used, the UISystem doesn't draw the options, instead the UIScreen does

Definition at line 77 of file UIMenu.hpp.

Here is the caller graph for this function:

Member Function Documentation

◆ animateSelection()

void UIMenu::animateSelection ( )
private

Definition at line 41 of file UIMenu.cpp.

◆ changeMenu()

ViewState UIMenu::changeMenu ( etl::span< MenuOption > newOptions)
protected

Changes the active menu.

Parameters
newOptionsthe new menu options.
Returns
ViewState the View to switch to

Definition at line 48 of file UIMenu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ closeHook()

virtual void UIMenu::closeHook ( )
privatepure virtual

Execute logic after the root menu is exited.

Implemented in BattleMenu, MainMenu, and PauseMenu.

Here is the caller graph for this function:

◆ getOptions()

etl::span< MenuOption > UIMenu::getOptions ( ) const
inline

Gets the options of the active menu.

Returns
etl::span<MenuOption> the active options

Definition at line 121 of file UIMenu.hpp.

◆ getSelectedOption()

int UIMenu::getSelectedOption ( ) const
inline

Gets the index of the selected option.

Returns
int the selected option index

Definition at line 101 of file UIMenu.hpp.

◆ getStartIndex()

int UIMenu::getStartIndex ( ) const
inline

Gets the index of the first visible option.

Returns
int the start index

Definition at line 111 of file UIMenu.hpp.

◆ prevOption()

void UIMenu::prevOption ( )
privatevirtual

Changes the current options to the previous options.

Note
Override if a menu manually manages its state (doesn't use changeMenu, default prevOption functions)

Reimplemented in BattleMenu.

Definition at line 70 of file UIMenu.cpp.

Here is the call graph for this function:

◆ resetHook()

virtual void UIMenu::resetHook ( )
privatepure virtual

Used to set the default pauseMessage and options values.

Implemented in BattleMenu, MainMenu, and PauseMenu.

Here is the caller graph for this function:

◆ resetMenu()

void UIMenu::resetMenu ( )
virtual

Resets the menu to its initial state.

Definition at line 7 of file UIMenu.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectionOffset()

int UIMenu::selectionOffset ( ) const

Definition at line 36 of file UIMenu.cpp.

◆ setVisibleOptions()

void UIMenu::setVisibleOptions ( int count)
inline

Sets the visible option count of a custom render menu, as UISystem only sets it for the menus it draws.

Parameters
countthe number of options visible at once

Definition at line 131 of file UIMenu.hpp.

◆ updateAnimation()

void UIMenu::updateAnimation ( )

Definition at line 30 of file UIMenu.cpp.

◆ updateHook()

ViewState UIMenu::updateHook ( )
virtual

Optional hook to call during the update loop.

Can override the return from the standard update loop

Reimplemented in BattleMenu, and PauseMenu.

Definition at line 89 of file UIMenu.cpp.

◆ UISystem

friend class UISystem
friend

Definition at line 41 of file UIMenu.hpp.

Member Data Documentation

◆ animator

UIAnimator UIMenu::animator
private

Definition at line 50 of file UIMenu.hpp.

◆ customRender

const bool UIMenu::customRender
private

Definition at line 46 of file UIMenu.hpp.

◆ isActive

bool UIMenu::isActive = false
protected

Definition at line 24 of file UIMenu.hpp.

◆ nextViewState

ViewState UIMenu::nextViewState = ViewState::KEEP_CURRENT
private

Definition at line 48 of file UIMenu.hpp.

◆ options

etl::span<MenuOption> UIMenu::options
protected

Definition at line 28 of file UIMenu.hpp.

◆ pauseMessage

std::string UIMenu::pauseMessage = "Pause"
protected

Definition at line 23 of file UIMenu.hpp.

◆ prevOptions

etl::stack<MenuState, 5> UIMenu::prevOptions
private

Definition at line 47 of file UIMenu.hpp.

◆ selectedOption

int UIMenu::selectedOption = 0
protected

Definition at line 29 of file UIMenu.hpp.

◆ selectionX

int UIMenu::selectionX = 0
private

Definition at line 49 of file UIMenu.hpp.

◆ startIndex

int UIMenu::startIndex = 0
protected

Definition at line 30 of file UIMenu.hpp.

◆ text

TextComponent* UIMenu::text = nullptr
protected

Definition at line 25 of file UIMenu.hpp.

◆ visibleOptions

int UIMenu::visibleOptions = 0
private
Note
visibleOptions is set via the UISystem via the ConfigureUIMenu event handler

Definition at line 45 of file UIMenu.hpp.


The documentation for this class was generated from the following files: