persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
PauseMenuScreen Class Reference

#include <PauseMenuScreen.hpp>

Inheritance diagram for PauseMenuScreen:
Collaboration diagram for PauseMenuScreen:

Public Member Functions

void load ()
 Loads graphics data into memory & pushes to VRAM.
void unload ()
 Unloads graphics data from memory.
void renderSprites () override
 Applys sprite colour palette & draws sprites to screen.
int onTouch (touchPosition *touch) override
 Hook to allow touch response.
void animateSelection ()
 Starts the jiggle animation on the selected option sprite.
void updateAnimation ()
 Updates active UI animations.
void updateAnimation (ae::q20_12_t dt)
 Updates active UI animations with a given delta time.
bool isAnimating () const
 Checks if the selection sprite is currently animating.
void cancelAnimation ()
 Cancels all animations.
void setTextComponent (TextComponent *text)
 Set the Text Component object.
void setOptionsTextComponent (TextComponent *optionsText)
 Set the Text Component used to draw the menu options.
void setYenText (const std::string &yen, TextColor color)
 Set the Yen Text object (info panel).
void setPersonaText (const std::string &persona, TextColor color)
 Set the Persona Text object (info panel).
void setArcanaText (const std::string &arcana, TextColor color)
 Set the Arcana Text object (info panel).
void setLevelText (const std::string &level, TextColor color)
 Set the Level Text object (info panel).
void setDescriptionText (const std::string &description, TextColor color)
 Set the Description Text object (top bar).
void renderText () override
 Draws the text.
void setMenu (const UIMenu *menu)
 Set the menu whose options are drawn on this screen.
int getVisibleOptions ()
 Gets how many option rows the screen shows.
Public Member Functions inherited from UIScreen
virtual void triggerAction (UIAction action)
 Trigger an action to be handled.
void removeSprites ()
 Clears the displayed sprites from the screen.
virtual ~UIScreen ()=default
 UIScreen (bool iIsMain)

Static Public Member Functions

static void create ()
static void destroy ()
static PauseMenuScreen * getInstance ()

Private Member Functions

 PauseMenuScreen ()
 ~PauseMenuScreen ()
void loadBackground ()
void renderBackground ()
void unloadBackground ()
void renderOptions ()
 Draws the visible options of the active menu and moves the selection bar to the selected one.
void updateSelectionSpritePosition ()
 Updates the positions of the selected option bar sprites (including jiggle offset).

Private Attributes

ae::Entity * pauseMenu = nullptr
GraphicsComponent * graphics = nullptr
TextComponent * text = nullptr
TextComponent * optionsText = nullptr
const UIMenu * menu = nullptr
int selectedBarBaseY = 0
int jiggleOffsetY = 0
UIAnimator animator
UIAnimationHandle selectionAnimation
const int visibleOptions = 7
const int optionsStartX = 26
const int optionsStartY = 52
const int optionsRowHeight = 19
TextColor optionColor = TextColor::RichBlue
TextColor selectedOptionColor = TextColor::DarkestBlue
std::string yenText = ""
TextColor yenColor = TextColor::DarkestBlue
std::string personaText = ""
TextColor personaColor = TextColor::DarkestBlue
std::string arcanaText = ""
TextColor arcanaColor = TextColor::DarkestBlue
std::string levelText = ""
TextColor levelColor = TextColor::DarkestBlue
std::string descriptionText = ""
TextColor descriptionColor = TextColor::White
const std::string bgPath = "graphics/PauseMenu/backgrounds/"
GraphicAsset bgPauseMenu = {}
const std::string spritePath = "graphics/PauseMenu/sprites/"
Sprite statusSprite = {SpriteSize_32x32, SpriteColorFormat_16Color, 0}
GraphicAsset statusGraphic = {}
SpriteRenderState srs0 = {statusSprite, 222, 138, 1, 0, false, false, false, false}
SpritePayload sp0 = {srs0, spritePath, statusGraphic, SpriteType::STATUS, (int)StatusSprite::STATUS_GREAT}
Sprite selectedOptionSprites [4]
GraphicAsset selectedOptionGraphics [4] = {}
const int selectedBarPieceWidth = 32
const int selectedBarYOffset = 7
SpriteRenderState srs1 = {selectedOptionSprites[0], 0, 0, 1, -1, false, false, false, false}
SpritePayload sp1
SpriteRenderState srs2 = {selectedOptionSprites[1], selectedBarPieceWidth, 0, 1, -1, false, false, false, false}
SpritePayload sp2
SpriteRenderState srs3
SpritePayload sp3
SpriteRenderState srs4
SpritePayload sp4
etl::array< SpritePayload, 5 > spritePayloads = {sp0, sp1, sp2, sp3, sp4}
etl::array< SpriteTransform, 0 > spriteTransforms = {}

Static Private Attributes

static PauseMenuScreen * instance = nullptr

Additional Inherited Members

Public Attributes inherited from UIScreen
int bgId = -1
bool isMain = false
OamState * oam = nullptr
bool isLoaded = false
Protected Member Functions inherited from UIScreen
void moveSprite (int spriteId, int x, int y)
 Moves the specified sprite to the specified position on the screen.
void showSprite (int spriteId)
 Shows the specified sprite on the screen.
void hideSprite (int spriteId)
 Hides the specified sprite on the screen.

Detailed Description

Definition at line 17 of file PauseMenuScreen.hpp.

Constructor & Destructor Documentation

◆ PauseMenuScreen()

PauseMenuScreen::PauseMenuScreen ( )
inlineprivate

Definition at line 132 of file PauseMenuScreen.hpp.

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

◆ ~PauseMenuScreen()

PauseMenuScreen::~PauseMenuScreen ( )
inlineprivate

Definition at line 133 of file PauseMenuScreen.hpp.

Member Function Documentation

◆ animateSelection()

void PauseMenuScreen::animateSelection ( )

Starts the jiggle animation on the selected option sprite.

Definition at line 153 of file PauseMenuScreen.cpp.

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

◆ cancelAnimation()

void PauseMenuScreen::cancelAnimation ( )

Cancels all animations.

Definition at line 187 of file PauseMenuScreen.cpp.

Here is the caller graph for this function:

◆ create()

void PauseMenuScreen::create ( )
static

Definition at line 8 of file PauseMenuScreen.cpp.

Here is the call graph for this function:

◆ destroy()

void PauseMenuScreen::destroy ( )
static

Definition at line 16 of file PauseMenuScreen.cpp.

◆ getInstance()

PauseMenuScreen * PauseMenuScreen::getInstance ( )
static

Definition at line 25 of file PauseMenuScreen.cpp.

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

◆ getVisibleOptions()

int PauseMenuScreen::getVisibleOptions ( )

Gets how many option rows the screen shows.

Returns
int the number of visible options

Definition at line 259 of file PauseMenuScreen.cpp.

◆ isAnimating()

bool PauseMenuScreen::isAnimating ( ) const

Checks if the selection sprite is currently animating.

Returns
true if currently animating, false otherwise

Definition at line 182 of file PauseMenuScreen.cpp.

◆ load()

void PauseMenuScreen::load ( )
virtual

Loads graphics data into memory & pushes to VRAM.

Implements UIScreen.

Definition at line 264 of file PauseMenuScreen.cpp.

Here is the call graph for this function:

◆ loadBackground()

void PauseMenuScreen::loadBackground ( )
private

Definition at line 64 of file PauseMenuScreen.cpp.

Here is the caller graph for this function:

◆ onTouch()

int PauseMenuScreen::onTouch ( touchPosition * touch)
overridevirtual

Hook to allow touch response.

Parameters
touchtouch input
Returns
int a value that acts as an id, used by calling code to understand which area has been touched

Reimplemented from UIScreen.

Definition at line 239 of file PauseMenuScreen.cpp.

◆ renderBackground()

void PauseMenuScreen::renderBackground ( )
private

Definition at line 70 of file PauseMenuScreen.cpp.

Here is the caller graph for this function:

◆ renderOptions()

void PauseMenuScreen::renderOptions ( )
private

Draws the visible options of the active menu and moves the selection bar to the selected one.

Definition at line 110 of file PauseMenuScreen.cpp.

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

◆ renderSprites()

void PauseMenuScreen::renderSprites ( )
overridevirtual

Applys sprite colour palette & draws sprites to screen.

index -1 is reserved for vflip/hflip, 0 is reserved for no transform

Reimplemented from UIScreen.

Definition at line 193 of file PauseMenuScreen.cpp.

Here is the call graph for this function:

◆ renderText()

void PauseMenuScreen::renderText ( )
overridevirtual

Draws the text.

Note
Must be re-called after anything clears the shared text component (e.g. menu navigation)

Reimplemented from UIScreen.

Definition at line 87 of file PauseMenuScreen.cpp.

Here is the call graph for this function:

◆ setArcanaText()

void PauseMenuScreen::setArcanaText ( const std::string & arcana,
TextColor color )

Set the Arcana Text object (info panel).

Parameters
arcanaThe active persona arcana string
colorThe text colour to render the arcana in

Definition at line 46 of file PauseMenuScreen.cpp.

◆ setDescriptionText()

void PauseMenuScreen::setDescriptionText ( const std::string & description,
TextColor color )

Set the Description Text object (top bar).

Parameters
descriptionThe description string
colorThe text colour to render the description in

Definition at line 58 of file PauseMenuScreen.cpp.

◆ setLevelText()

void PauseMenuScreen::setLevelText ( const std::string & level,
TextColor color )

Set the Level Text object (info panel).

Parameters
levelThe active persona level string
colorThe text colour to render the level in

Definition at line 52 of file PauseMenuScreen.cpp.

◆ setMenu()

void PauseMenuScreen::setMenu ( const UIMenu * menu)

Set the menu whose options are drawn on this screen.

Parameters
menuThe UIMenu pointer to set
Warning
This will be removed in the future in favour of a native dependency injection solution in Aegis Engine

Definition at line 254 of file PauseMenuScreen.cpp.

◆ setOptionsTextComponent()

void PauseMenuScreen::setOptionsTextComponent ( TextComponent * optionsText)

Set the Text Component used to draw the menu options.

Parameters
optionsTextThe TextComponent pointer to set
Warning
This will be removed in the future in favour of a native dependency injection solution in Aegis Engine

Definition at line 249 of file PauseMenuScreen.cpp.

◆ setPersonaText()

void PauseMenuScreen::setPersonaText ( const std::string & persona,
TextColor color )

Set the Persona Text object (info panel).

Parameters
personaThe active persona name string
colorThe text colour to render the persona name in

Definition at line 40 of file PauseMenuScreen.cpp.

◆ setTextComponent()

void PauseMenuScreen::setTextComponent ( TextComponent * text)

Set the Text Component object.

Parameters
textThe TextComponent pointer to set
Warning
This will be removed in the future in favour of a native dependency injection solution in Aegis Engine

Definition at line 244 of file PauseMenuScreen.cpp.

◆ setYenText()

void PauseMenuScreen::setYenText ( const std::string & yen,
TextColor color )

Set the Yen Text object (info panel).

Parameters
yenThe yen amount string
colorThe text colour to render the yen amount in

Definition at line 34 of file PauseMenuScreen.cpp.

◆ unload()

void PauseMenuScreen::unload ( )
virtual

Unloads graphics data from memory.

Implements UIScreen.

Definition at line 296 of file PauseMenuScreen.cpp.

Here is the call graph for this function:

◆ unloadBackground()

void PauseMenuScreen::unloadBackground ( )
private

Definition at line 80 of file PauseMenuScreen.cpp.

Here is the caller graph for this function:

◆ updateAnimation() [1/2]

void PauseMenuScreen::updateAnimation ( )

Updates active UI animations.

Definition at line 165 of file PauseMenuScreen.cpp.

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

◆ updateAnimation() [2/2]

void PauseMenuScreen::updateAnimation ( ae::q20_12_t dt)

Updates active UI animations with a given delta time.

Parameters
dtDelta time in seconds (Q20.12)

Definition at line 171 of file PauseMenuScreen.cpp.

Here is the call graph for this function:

◆ updateSelectionSpritePosition()

void PauseMenuScreen::updateSelectionSpritePosition ( )
private

Updates the positions of the selected option bar sprites (including jiggle offset).

Definition at line 138 of file PauseMenuScreen.cpp.

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

Member Data Documentation

◆ animator

UIAnimator PauseMenuScreen::animator
private

Definition at line 158 of file PauseMenuScreen.hpp.

◆ arcanaColor

TextColor PauseMenuScreen::arcanaColor = TextColor::DarkestBlue
private

Definition at line 177 of file PauseMenuScreen.hpp.

◆ arcanaText

std::string PauseMenuScreen::arcanaText = ""
private

Definition at line 176 of file PauseMenuScreen.hpp.

◆ bgPath

const std::string PauseMenuScreen::bgPath = "graphics/PauseMenu/backgrounds/"
private

Definition at line 186 of file PauseMenuScreen.hpp.

◆ bgPauseMenu

GraphicAsset PauseMenuScreen::bgPauseMenu = {}
private

Definition at line 188 of file PauseMenuScreen.hpp.

◆ descriptionColor

TextColor PauseMenuScreen::descriptionColor = TextColor::White
private

Definition at line 183 of file PauseMenuScreen.hpp.

◆ descriptionText

std::string PauseMenuScreen::descriptionText = ""
private

Definition at line 182 of file PauseMenuScreen.hpp.

◆ graphics

GraphicsComponent* PauseMenuScreen::graphics = nullptr
private

Definition at line 151 of file PauseMenuScreen.hpp.

◆ instance

PauseMenuScreen * PauseMenuScreen::instance = nullptr
staticprivate

Definition at line 134 of file PauseMenuScreen.hpp.

◆ jiggleOffsetY

int PauseMenuScreen::jiggleOffsetY = 0
private

Definition at line 157 of file PauseMenuScreen.hpp.

◆ levelColor

TextColor PauseMenuScreen::levelColor = TextColor::DarkestBlue
private

Definition at line 180 of file PauseMenuScreen.hpp.

◆ levelText

std::string PauseMenuScreen::levelText = ""
private

Definition at line 179 of file PauseMenuScreen.hpp.

◆ menu

const UIMenu* PauseMenuScreen::menu = nullptr
private

Definition at line 154 of file PauseMenuScreen.hpp.

◆ optionColor

TextColor PauseMenuScreen::optionColor = TextColor::RichBlue
private

Definition at line 166 of file PauseMenuScreen.hpp.

◆ optionsRowHeight

const int PauseMenuScreen::optionsRowHeight = 19
private

Definition at line 165 of file PauseMenuScreen.hpp.

◆ optionsStartX

const int PauseMenuScreen::optionsStartX = 26
private

Definition at line 163 of file PauseMenuScreen.hpp.

◆ optionsStartY

const int PauseMenuScreen::optionsStartY = 52
private

Definition at line 164 of file PauseMenuScreen.hpp.

◆ optionsText

TextComponent* PauseMenuScreen::optionsText = nullptr
private

Definition at line 153 of file PauseMenuScreen.hpp.

◆ pauseMenu

ae::Entity* PauseMenuScreen::pauseMenu = nullptr
private

Definition at line 150 of file PauseMenuScreen.hpp.

◆ personaColor

TextColor PauseMenuScreen::personaColor = TextColor::DarkestBlue
private

Definition at line 174 of file PauseMenuScreen.hpp.

◆ personaText

std::string PauseMenuScreen::personaText = ""
private

Definition at line 173 of file PauseMenuScreen.hpp.

◆ selectedBarBaseY

int PauseMenuScreen::selectedBarBaseY = 0
private

Definition at line 156 of file PauseMenuScreen.hpp.

◆ selectedBarPieceWidth

const int PauseMenuScreen::selectedBarPieceWidth = 32
private

Definition at line 206 of file PauseMenuScreen.hpp.

◆ selectedBarYOffset

const int PauseMenuScreen::selectedBarYOffset = 7
private

Definition at line 207 of file PauseMenuScreen.hpp.

◆ selectedOptionColor

TextColor PauseMenuScreen::selectedOptionColor = TextColor::DarkestBlue
private

Definition at line 167 of file PauseMenuScreen.hpp.

◆ selectedOptionGraphics

GraphicAsset PauseMenuScreen::selectedOptionGraphics[4] = {}
private

Definition at line 204 of file PauseMenuScreen.hpp.

◆ selectedOptionSprites

Sprite PauseMenuScreen::selectedOptionSprites[4]
private
Initial value:
= {{SpriteSize_32x16, SpriteColorFormat_16Color, 0},
{SpriteSize_32x16, SpriteColorFormat_16Color, 0},
{SpriteSize_32x16, SpriteColorFormat_16Color, 0},
{SpriteSize_32x16, SpriteColorFormat_16Color, 0}}

Definition at line 200 of file PauseMenuScreen.hpp.

◆ selectionAnimation

UIAnimationHandle PauseMenuScreen::selectionAnimation
private

Definition at line 159 of file PauseMenuScreen.hpp.

◆ sp0

Definition at line 197 of file PauseMenuScreen.hpp.

◆ sp1

SpritePayload PauseMenuScreen::sp1
private

◆ sp2

SpritePayload PauseMenuScreen::sp2
private

◆ sp3

SpritePayload PauseMenuScreen::sp3
private

◆ sp4

SpritePayload PauseMenuScreen::sp4
private

◆ spritePath

const std::string PauseMenuScreen::spritePath = "graphics/PauseMenu/sprites/"
private

Definition at line 191 of file PauseMenuScreen.hpp.

◆ spritePayloads

etl::array<SpritePayload, 5> PauseMenuScreen::spritePayloads = {sp0, sp1, sp2, sp3, sp4}
private

Definition at line 240 of file PauseMenuScreen.hpp.

◆ spriteTransforms

etl::array<SpriteTransform, 0> PauseMenuScreen::spriteTransforms = {}
private

Definition at line 242 of file PauseMenuScreen.hpp.

◆ srs0

SpriteRenderState PauseMenuScreen::srs0 = {statusSprite, 222, 138, 1, 0, false, false, false, false}
private

Definition at line 196 of file PauseMenuScreen.hpp.

◆ srs1

SpriteRenderState PauseMenuScreen::srs1 = {selectedOptionSprites[0], 0, 0, 1, -1, false, false, false, false}
private

Definition at line 209 of file PauseMenuScreen.hpp.

◆ srs2

SpriteRenderState PauseMenuScreen::srs2 = {selectedOptionSprites[1], selectedBarPieceWidth, 0, 1, -1, false, false, false, false}
private

Definition at line 216 of file PauseMenuScreen.hpp.

◆ srs3

SpriteRenderState PauseMenuScreen::srs3
private
Initial value:
= {
selectedOptionSprites[2], selectedBarPieceWidth * 2, 0, 1, -1, false, false, false, false}
Sprite selectedOptionSprites[4]
const int selectedBarPieceWidth

Definition at line 223 of file PauseMenuScreen.hpp.

◆ srs4

SpriteRenderState PauseMenuScreen::srs4
private
Initial value:
= {
selectedOptionSprites[3], selectedBarPieceWidth * 3, 0, 1, -1, false, false, false, false}

Definition at line 231 of file PauseMenuScreen.hpp.

◆ statusGraphic

GraphicAsset PauseMenuScreen::statusGraphic = {}
private

Definition at line 195 of file PauseMenuScreen.hpp.

◆ statusSprite

Sprite PauseMenuScreen::statusSprite = {SpriteSize_32x32, SpriteColorFormat_16Color, 0}
private

Definition at line 194 of file PauseMenuScreen.hpp.

◆ text

TextComponent* PauseMenuScreen::text = nullptr
private

Definition at line 152 of file PauseMenuScreen.hpp.

◆ visibleOptions

const int PauseMenuScreen::visibleOptions = 7
private

Definition at line 162 of file PauseMenuScreen.hpp.

◆ yenColor

TextColor PauseMenuScreen::yenColor = TextColor::DarkestBlue
private

Definition at line 171 of file PauseMenuScreen.hpp.

◆ yenText

std::string PauseMenuScreen::yenText = ""
private

Definition at line 170 of file PauseMenuScreen.hpp.


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