15static void drawPixel(uint16_t* videoBuffer,
int x,
int y,
int paletteValue)
17 if (!videoBuffer || x < 0 || x >= 256 || y < 0 || y >= 192)
22 int wordIndex = (y * 256 + x) / 2;
23 u16 currentWord = videoBuffer[wordIndex];
27 videoBuffer[wordIndex] = (currentWord & 0xFF00) | (paletteValue & 0xFF);
32 videoBuffer[wordIndex] = (currentWord & 0x00FF) | ((paletteValue & 0xFF) << 8);
67 for (
int i = 0; i < 10; ++i)
75 bool endFound =
false;
76 for (
int i = 9; i >= 0; --i)
123 dmaCopy(
bgUI[bgIndex].pal, BG_PALETTE_SUB,
bgUI[bgIndex].palLen);
124 TextManager::getInstance().loadDefaultPalette();
127 dmaFillHalfWords(0, bgGetMapPtr(
bgId), 2048);
128 dmaCopy(
bgUI[bgIndex].tiles, bgGetGfxPtr(
bgId),
bgUI[bgIndex].tilesLen);
129 dmaCopy(
bgUI[bgIndex].map, bgGetMapPtr(
bgId),
bgUI[bgIndex].mapLen);
149 dmaFillHalfWords(0, bgGetMapPtr(
bgId), 2048);
150 dmaFillHalfWords(0, BG_PALETTE_SUB,
bgUI[0].palLen);
162 if (
frame % 60 == 30)
198 char c =
keyboard.evaluateInput(touch);
199 const unsigned char input =
static_cast<unsigned char>(c);
282 text->drawText(status, 10, 5);
287 text->clearArea(65, 31, 125, 30);
288 for (
int i = 0; i < 10; i++)
298 for (
int i = 0; i < 10; i++)
329 for (
int i = 0; i < 9; i++)
338 text->clearArea(65, 42, 126, 1);
339 text->clearArea(65, 59, 126, 1);
419 bool endFound =
false;
420 for (
int i = 9; i >= 0; --i)
444 setBackdropColor(ARGB16(1, 0, 0, 4));
448 int bgTextSub = bgInitSub(3, BgType_Bmp8, BgSize_B8_256x256, 4, 0);
450 bgSetPriority(bgTextSub, 0);
451 bgSetPriority(
bgId, 1);
469 for (
int i = 0; i < 10; ++i)
static void drawPixel(uint16_t *videoBuffer, int x, int y, int paletteValue)
Draws a pixel to the specified videobuffer.
Handles the Rendering & Logic for the Sign Contract UI.
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.
ae::Entity * signContractUI
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.
static SignContractScreen * getInstance()
void clearCursor()
Clears the previously rendered cursor from the screen.
uint16_t * bgTextBufferSub
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...
Holds global variables used game-wide.
volatile u32 systemKeysDown
@ CAPSLOCK
Zero is reserved for not touching the keyboard.
Event payload to trigger a save write.
Stores data for a single glyph (character) in a font.
A struct that holds initial config values for the TextComponent.