persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
SignContractScreen.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
12#include "core/keyboard.hpp"
13
14#include <etl/vector.h>
15#include <nds.h>
16
18{
19 public:
20 static void create();
21 static void destroy();
23
24 void load();
25 void unload();
26
32 int update();
33
37 void renderSprites() override;
38
44 int onTouch(touchPosition* touch) override;
45
46 private:
50
54 void loadSaveDataName();
55
60 void loadBackgrounds();
61
65 void switchBackground();
66
71 void renderBackground(int bgIndex = 0);
72
76 void unloadBackgrounds();
77
83 void writeCharacter(char c);
84
89 void updateStatus(std::string status);
90
94 void renderName();
95
100 void renderCursor();
101
105 void clearCursor();
106
111 int confirmAction();
115 void backSpaceAction();
119 void moveCursorLeft();
123 void moveCursorRight();
124
129
130 ae::Entity* signContractUI = nullptr;
132 TextComponent* text = nullptr;
133
134 uint16_t* bgTextBufferSub = nullptr;
135
137
138 std::string FONT_NAME = "cosmetica";
139 int FONT_SIZE = 10;
140 int lineSpacing = 0;
141
142 bool cursorRendered = false;
143
144 // backgrounds
145 const std::string bgPath = "graphics/SignContractView/backgrounds/";
147
148 bool isLastName = true;
149 int index = 0;
150 char firstName[10] = " ";
151 char lastName[10] = " ";
152
153 // TODO: move these variables into keyboard class once that gets a proper implementation
154 // Currently we need them to handle the background switching
155 bool isShift = false;
156 bool isCapsLock = false;
157};
Orchestrates graphic loading and management.
Orchestrates rendering text from a bitmap.
On-Screen keyboard.
Definition keyboard.hpp:79
void loadBackgrounds()
Loads background assets into RAM.
void renderSprites() override
Renders the background and status text to the screen.
void load()
Loads graphics data into memory & pushes to VRAM.
void loadSaveDataName()
Loads the name from the save data file into a local variable.
void moveCursorLeft()
Moves the cursor to the left in the name input area.
void renderBackground(int bgIndex=0)
Pushes background data into VRAM so that it is rendered on screen.
static SignContractScreen * instance
void switchBackground()
Switches the rendered background between the default and shift/capslock backgrounds.
int confirmAction()
Handles the logic for when the user presses the confirm button.
void writeCharacter(char c)
Writes a character to the name buffer at the current index and increments the index.
void backSpaceAction()
Handles logic for when user presses the backspace button.
void renderName()
Clears any old name text and writes the current name buffer to the name input area.
void unload()
Unloads graphics data from memory.
void moveCursorRight()
Moves the cursor to the right in the name input area.
GraphicsComponent * graphics
int update()
Frame update function for the SignContractScreen. Handles cursor blinking and button presses.
void unloadBackgrounds()
Clears the current background from VRAM and unloads the background data from RAM.
const std::string bgPath
static SignContractScreen * getInstance()
void clearCursor()
Clears the previously rendered cursor from the screen.
OnScreenKeyboard keyboard
void sendCursorToEndOfLastName()
Helper function to set the cursor index to the end of the last name, if any characters have been writ...
void updateStatus(std::string status)
Clears any old status text and writes a new status to the status text box.
void renderCursor()
Renders a small cursor at the current slot where the next character will be written in the name buffe...
int onTouch(touchPosition *touch) override
Handles touch input. Will check if any of the keyboard keys were pressed and execute any necessary ac...
UIScreen(bool iIsMain)
Definition UIScreen.hpp:55
Acts as an onscreen keyboard and converts touch inputs into characters.
Holds loaded graphics data.