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

#include <SignContractScreen.hpp>

Inheritance diagram for SignContractScreen:
Collaboration diagram for SignContractScreen:

Public Member Functions

void load ()
 Loads graphics data into memory & pushes to VRAM.
void unload ()
 Unloads graphics data from memory.
int update ()
 Frame update function for the SignContractScreen. Handles cursor blinking and button presses.
void renderSprites () override
 Renders the background and status text to the screen.
int onTouch (touchPosition *touch) override
 Handles touch input. Will check if any of the keyboard keys were pressed and execute any necessary actions.
Public Member Functions inherited from UIScreen
virtual void triggerAction (UIAction action)
 Trigger an action to be handled.
virtual void renderText ()
 Draws the screen's text. Called after the background is shown.
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 SignContractScreen * getInstance ()

Private Member Functions

 SignContractScreen ()
 ~SignContractScreen ()
void loadSaveDataName ()
 Loads the name from the save data file into a local variable.
void loadBackgrounds ()
 Loads background assets into RAM.
void switchBackground ()
 Switches the rendered background between the default and shift/capslock backgrounds.
void renderBackground (int bgIndex=0)
 Pushes background data into VRAM so that it is rendered on screen.
void unloadBackgrounds ()
 Clears the current background from VRAM and unloads the background data from RAM.
void writeCharacter (char c)
 Writes a character to the name buffer at the current index and increments the index.
void updateStatus (std::string status)
 Clears any old status text and writes a new status to the status text box.
void renderName ()
 Clears any old name text and writes the current name buffer to the name input area.
void renderCursor ()
 Renders a small cursor at the current slot where the next character will be written in the name buffer.
void clearCursor ()
 Clears the previously rendered cursor from the screen.
int confirmAction ()
 Handles the logic for when the user presses the confirm button.
void backSpaceAction ()
 Handles logic for when user presses the backspace button.
void moveCursorLeft ()
 Moves the cursor to the left in the name input area.
void moveCursorRight ()
 Moves the cursor to the right in the name input area.
void sendCursorToEndOfLastName ()
 Helper function to set the cursor index to the end of the last name, if any characters have been written to the last name buffer. If no characters have been written, the cursor will be set to the start of the last name buffer.

Private Attributes

ae::Entity * signContractUI = nullptr
GraphicsComponent * graphics = nullptr
TextComponent * text = nullptr
uint16_t * bgTextBufferSub = nullptr
OnScreenKeyboard keyboard
std::string FONT_NAME = "cosmetica"
int FONT_SIZE = 10
int lineSpacing = 0
bool cursorRendered = false
const std::string bgPath = "graphics/SignContractView/backgrounds/"
GraphicAsset bgUI [2] = {}
bool isLastName = true
int index = 0
char firstName [10] = " "
char lastName [10] = " "
bool isShift = false
bool isCapsLock = false

Static Private Attributes

static SignContractScreen * 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 SignContractScreen.hpp.

Constructor & Destructor Documentation

◆ SignContractScreen()

SignContractScreen::SignContractScreen ( )
inlineprivate

Definition at line 47 of file SignContractScreen.hpp.

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

◆ ~SignContractScreen()

SignContractScreen::~SignContractScreen ( )
inlineprivate

Definition at line 48 of file SignContractScreen.hpp.

Member Function Documentation

◆ backSpaceAction()

void SignContractScreen::backSpaceAction ( )
private

Handles logic for when user presses the backspace button.

Definition at line 359 of file SignContractScreen.cpp.

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

◆ clearCursor()

void SignContractScreen::clearCursor ( )
private

Clears the previously rendered cursor from the screen.

Definition at line 335 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ confirmAction()

int SignContractScreen::confirmAction ( )
private

Handles the logic for when the user presses the confirm button.

Returns
int Return code to indicate if the game should proceed to the next view

Definition at line 342 of file SignContractScreen.cpp.

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

◆ create()

void SignContractScreen::create ( )
static

Definition at line 38 of file SignContractScreen.cpp.

Here is the call graph for this function:

◆ destroy()

void SignContractScreen::destroy ( )
static

Definition at line 46 of file SignContractScreen.cpp.

◆ getInstance()

SignContractScreen * SignContractScreen::getInstance ( )
static

Definition at line 55 of file SignContractScreen.cpp.

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

◆ load()

void SignContractScreen::load ( )
virtual

Loads graphics data into memory & pushes to VRAM.

Implements UIScreen.

Definition at line 435 of file SignContractScreen.cpp.

Here is the call graph for this function:

◆ loadBackgrounds()

void SignContractScreen::loadBackgrounds ( )
private

Loads background assets into RAM.

Note
This does not push the backgrounds into VRAM. The background assets will remain in memory until they are unloaded.

Definition at line 100 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ loadSaveDataName()

void SignContractScreen::loadSaveDataName ( )
private

Loads the name from the save data file into a local variable.

Definition at line 64 of file SignContractScreen.cpp.

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

◆ moveCursorLeft()

void SignContractScreen::moveCursorLeft ( )
private

Moves the cursor to the left in the name input area.

Definition at line 388 of file SignContractScreen.cpp.

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

◆ moveCursorRight()

void SignContractScreen::moveCursorRight ( )
private

Moves the cursor to the right in the name input area.

Definition at line 403 of file SignContractScreen.cpp.

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

◆ onTouch()

int SignContractScreen::onTouch ( touchPosition * touch)
overridevirtual

Handles touch input. Will check if any of the keyboard keys were pressed and execute any necessary actions.

Parameters
touchTouch input variable
Returns
int Return code to indicate if the game should proceed to the next view

Reimplemented from UIScreen.

Definition at line 196 of file SignContractScreen.cpp.

Here is the call graph for this function:

◆ renderBackground()

void SignContractScreen::renderBackground ( int bgIndex = 0)
private

Pushes background data into VRAM so that it is rendered on screen.

Parameters
bgIndexThe id of the background to render. 0 = default, 1 = shift/capslock

Definition at line 120 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ renderCursor()

void SignContractScreen::renderCursor ( )
private

Renders a small cursor at the current slot where the next character will be written in the name buffer.

Note
Will write "End" at the end behind the name input area if the index exceeds the array bounds of the name

Definition at line 310 of file SignContractScreen.cpp.

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

◆ renderName()

void SignContractScreen::renderName ( )
private

Clears any old name text and writes the current name buffer to the name input area.

Definition at line 285 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ renderSprites()

void SignContractScreen::renderSprites ( )
overridevirtual

Renders the background and status text to the screen.

Reimplemented from UIScreen.

Definition at line 107 of file SignContractScreen.cpp.

Here is the call graph for this function:

◆ sendCursorToEndOfLastName()

void SignContractScreen::sendCursorToEndOfLastName ( )
private

Helper function to set the cursor index to the end of the last name, if any characters have been written to the last name buffer. If no characters have been written, the cursor will be set to the start of the last name buffer.

Definition at line 417 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ switchBackground()

void SignContractScreen::switchBackground ( )
private

Switches the rendered background between the default and shift/capslock backgrounds.

Definition at line 132 of file SignContractScreen.cpp.

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

◆ unload()

void SignContractScreen::unload ( )
virtual

Unloads graphics data from memory.

Implements UIScreen.

Definition at line 466 of file SignContractScreen.cpp.

Here is the call graph for this function:

◆ unloadBackgrounds()

void SignContractScreen::unloadBackgrounds ( )
private

Clears the current background from VRAM and unloads the background data from RAM.

Definition at line 146 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ update()

int SignContractScreen::update ( )

Frame update function for the SignContractScreen. Handles cursor blinking and button presses.

Returns
int Returns code to indicate if the game should proceed to the next view. 0 = no action, 1 = proceed to next view

Definition at line 159 of file SignContractScreen.cpp.

Here is the call graph for this function:

◆ updateStatus()

void SignContractScreen::updateStatus ( std::string status)
private

Clears any old status text and writes a new status to the status text box.

Parameters
statusString of the status to write

Definition at line 279 of file SignContractScreen.cpp.

Here is the caller graph for this function:

◆ writeCharacter()

void SignContractScreen::writeCharacter ( char c)
private

Writes a character to the name buffer at the current index and increments the index.

Parameters
cThe character to write to the name buffer
Note
Will stop writing characters if the index is at the end of the name buffer (20 characters)

Definition at line 251 of file SignContractScreen.cpp.

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

Member Data Documentation

◆ bgPath

const std::string SignContractScreen::bgPath = "graphics/SignContractView/backgrounds/"
private

Definition at line 145 of file SignContractScreen.hpp.

◆ bgTextBufferSub

uint16_t* SignContractScreen::bgTextBufferSub = nullptr
private

Definition at line 134 of file SignContractScreen.hpp.

◆ bgUI

GraphicAsset SignContractScreen::bgUI[2] = {}
private

Definition at line 146 of file SignContractScreen.hpp.

◆ cursorRendered

bool SignContractScreen::cursorRendered = false
private

Definition at line 142 of file SignContractScreen.hpp.

◆ firstName

char SignContractScreen::firstName[10] = " "
private

Definition at line 150 of file SignContractScreen.hpp.

◆ FONT_NAME

std::string SignContractScreen::FONT_NAME = "cosmetica"
private

Definition at line 138 of file SignContractScreen.hpp.

◆ FONT_SIZE

int SignContractScreen::FONT_SIZE = 10
private

Definition at line 139 of file SignContractScreen.hpp.

◆ graphics

GraphicsComponent* SignContractScreen::graphics = nullptr
private

Definition at line 131 of file SignContractScreen.hpp.

◆ index

int SignContractScreen::index = 0
private

Definition at line 149 of file SignContractScreen.hpp.

◆ instance

SignContractScreen * SignContractScreen::instance = nullptr
staticprivate

Definition at line 49 of file SignContractScreen.hpp.

◆ isCapsLock

bool SignContractScreen::isCapsLock = false
private

Definition at line 156 of file SignContractScreen.hpp.

◆ isLastName

bool SignContractScreen::isLastName = true
private

Definition at line 148 of file SignContractScreen.hpp.

◆ isShift

bool SignContractScreen::isShift = false
private

Definition at line 155 of file SignContractScreen.hpp.

◆ keyboard

OnScreenKeyboard SignContractScreen::keyboard
private

Definition at line 136 of file SignContractScreen.hpp.

◆ lastName

char SignContractScreen::lastName[10] = " "
private

Definition at line 151 of file SignContractScreen.hpp.

◆ lineSpacing

int SignContractScreen::lineSpacing = 0
private

Definition at line 140 of file SignContractScreen.hpp.

◆ signContractUI

ae::Entity* SignContractScreen::signContractUI = nullptr
private

Definition at line 130 of file SignContractScreen.hpp.

◆ text

TextComponent* SignContractScreen::text = nullptr
private

Definition at line 132 of file SignContractScreen.hpp.


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