Support resetting screen

This commit is contained in:
Jaby 2024-01-15 20:59:55 -05:00
parent b60f38046e
commit e84f6f6323
1 changed files with 15 additions and 0 deletions

View File

@ -85,6 +85,7 @@ namespace ScreenCenter {
} }
static void update_interactive(); static void update_interactive();
static void reset_screen();
static void update_enter_state() { static void update_enter_state() {
static const char IntroductionTest[] = "Press START to begin"; static const char IntroductionTest[] = "Press START to begin";
@ -128,6 +129,13 @@ namespace ScreenCenter {
handle_button(button_pulse[2], GenericButton::Up, offset_y, -1); handle_button(button_pulse[2], GenericButton::Up, offset_y, -1);
handle_button(button_pulse[3], GenericButton::Down, offset_y, 1); handle_button(button_pulse[3], GenericButton::Down, offset_y, 1);
if(controller.button.is_down(GenericButton::R1) && controller.button.is_down(GenericButton::L1)) {
for(auto& pulse : button_pulse) {
pulse.setup();
}
reset_screen();
}
auto cursor = FontWriter::update(CenterPoint.move(-offset_x, -offset_y)); auto cursor = FontWriter::update(CenterPoint.move(-offset_x, -offset_y));
FontWriter::bios_font_writer.write(cursor, ModeStr, GPU::Color24::White(), TVModeStr); FontWriter::bios_font_writer.write(cursor, ModeStr, GPU::Color24::White(), TVModeStr);
FontWriter::bios_font_writer.write(cursor, FormularStr, GPU::Color24::White()); FontWriter::bios_font_writer.write(cursor, FormularStr, GPU::Color24::White());
@ -136,6 +144,12 @@ namespace ScreenCenter {
PSYQ::set_offset(offset_x, offset_y); PSYQ::set_offset(offset_x, offset_y);
} }
static void reset_screen() {
PSYQ::set_offset(0, 0);
offset_x = 0;
offset_y = 0;
}
static void setup() { static void setup() {
Shared::back_menu.reset(); Shared::back_menu.reset();
@ -168,6 +182,7 @@ namespace ScreenCenter {
while(true) { while(true) {
if(update_or_exit()) { if(update_or_exit()) {
reset_screen();
break; break;
} }
GPU::swap_buffers_vsync(1); GPU::swap_buffers_vsync(1);