Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | List of all members
core::battle::view::PlayerMenu Class Reference

The player menu for battles. More...

#include <PlayerMenu.hpp>

Public Member Functions

 PlayerMenu (bl::engine::Engine &engine, bool canRun)
 Construct a new Player Menu. More...
 
void init (bl::rc::scene::CodeScene *scene)
 Creates UI elements and adds them to the scene. More...
 
void refresh ()
 Polls state from opened peoplemon or bag menu. More...
 
void setPeoplemon (int i, const pplmn::BattlePeoplemon &ppl)
 Updates the menu for the given peoplemon. More...
 
void beginTurn ()
 Resets the menu to the turn start state. More...
 
void choosePeoplemonMidTurn (bool fromFaint, bool fromRevive)
 Opens the menu to select a peoplemon to send out. More...
 
void chooseMoveToForget ()
 Initiates the process of choosing the move to forget. More...
 
bool ready () const
 Returns true when the player's choice has been made. More...
 
TurnAction selectedAction () const
 The selected turn action. More...
 
int selectedMove () const
 Returns the selected move index. More...
 
item::Id selectedItem () const
 Returns the selected item. More...
 
int selectedPeoplemon () const
 Returns the selected peoplemon index. More...
 
void handleInput (input::EntityControl input, bool ignoreDebounce)
 Processes player input to update the menu state. More...
 
void render (bl::rc::scene::CodeScene::RenderContext &ctx)
 Renders the menu. More...
 

Detailed Description

The player menu for battles.

Definition at line 29 of file PlayerMenu.hpp.

Constructor & Destructor Documentation

◆ PlayerMenu()

core::battle::view::PlayerMenu::PlayerMenu ( bl::engine::Engine &  engine,
bool  canRun 
)

Construct a new Player Menu.

Parameters
engineThe game engine instance
canRunWhether or not to allow running

Definition at line 21 of file PlayerMenu.cpp.

Member Function Documentation

◆ beginTurn()

void core::battle::view::PlayerMenu::beginTurn ( )

Resets the menu to the turn start state.

Definition at line 154 of file PlayerMenu.cpp.

◆ chooseMoveToForget()

void core::battle::view::PlayerMenu::chooseMoveToForget ( )

Initiates the process of choosing the move to forget.

Definition at line 183 of file PlayerMenu.cpp.

◆ choosePeoplemonMidTurn()

void core::battle::view::PlayerMenu::choosePeoplemonMidTurn ( bool  fromFaint,
bool  fromRevive 
)

Opens the menu to select a peoplemon to send out.

Parameters
fromFaintTrue if the current peoplemon has fainted
fromReviveTrue if the eligible peoplemon must be fainted

Definition at line 159 of file PlayerMenu.cpp.

◆ handleInput()

void core::battle::view::PlayerMenu::handleInput ( input::EntityControl  input,
bool  ignoreDebounce 
)

Processes player input to update the menu state.

Parameters
inputThe control to handle
ignoreDebounceTrue to process always, false to rate limit

Definition at line 198 of file PlayerMenu.cpp.

◆ init()

void core::battle::view::PlayerMenu::init ( bl::rc::scene::CodeScene *  scene)

Creates UI elements and adds them to the scene.

Parameters
sceneThe scene to use

Definition at line 31 of file PlayerMenu.cpp.

◆ ready()

bool core::battle::view::PlayerMenu::ready ( ) const

Returns true when the player's choice has been made.

Definition at line 188 of file PlayerMenu.cpp.

◆ refresh()

void core::battle::view::PlayerMenu::refresh ( )

Polls state from opened peoplemon or bag menu.

Definition at line 132 of file PlayerMenu.cpp.

◆ render()

void core::battle::view::PlayerMenu::render ( bl::rc::scene::CodeScene::RenderContext &  ctx)

Renders the menu.

Parameters
ctxThe render context

Definition at line 213 of file PlayerMenu.cpp.

◆ selectedAction()

TurnAction core::battle::view::PlayerMenu::selectedAction ( ) const

The selected turn action.

Definition at line 190 of file PlayerMenu.cpp.

◆ selectedItem()

item::Id core::battle::view::PlayerMenu::selectedItem ( ) const

Returns the selected item.

Definition at line 194 of file PlayerMenu.cpp.

◆ selectedMove()

int core::battle::view::PlayerMenu::selectedMove ( ) const

Returns the selected move index.

Definition at line 192 of file PlayerMenu.cpp.

◆ selectedPeoplemon()

int core::battle::view::PlayerMenu::selectedPeoplemon ( ) const

Returns the selected peoplemon index.

Definition at line 196 of file PlayerMenu.cpp.

◆ setPeoplemon()

void core::battle::view::PlayerMenu::setPeoplemon ( int  i,
const pplmn::BattlePeoplemon ppl 
)

Updates the menu for the given peoplemon.

Parameters
iThe index of the peoplemon in the team
pplThe peoplemon itself

Definition at line 93 of file PlayerMenu.cpp.


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