Support Second controller port (or not if disabled) and have a fancy background

This commit is contained in:
2024-01-04 22:28:25 -06:00
parent 8a7bcf92fa
commit 60c4c5e61f
5 changed files with 46 additions and 25 deletions

View File

@@ -1,5 +1,4 @@
#include "../../../include/shared.hpp"
#include "../../include/font_writer.hpp"
#include "include/controller_state.hpp"
#include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
@@ -7,11 +6,13 @@
namespace ControllerTest {
using namespace JabyEngine;
static auto controller_state = ControllerState::create();
static auto controller_state0 = ControllerState::create(Make::PositionI16(0, 0));
static auto controller_state1 = ControllerState::create(Make::PositionI16(0, 76));
static void setup() {
Shared::back_menu.reset();
controller_state.setup();
controller_state0.setup();
controller_state1.setup();
}
static bool update_or_exit() {
@@ -20,12 +21,15 @@ namespace ControllerTest {
return true;
}
controller_state.update(Periphery::get_primary_controller_as<JabyEngine::Periphery::AnalogeController>(), FontWriter::new_font_writer);
controller_state0.update(&Periphery::get_primary_controller_as<JabyEngine::Periphery::AnalogeController>(), FontWriter::new_font_writer);
controller_state1.update(Periphery::PortCount > 1 ? &Periphery::get_controller_as<JabyEngine::Periphery::AnalogeController>(1, 0) : nullptr, FontWriter::new_font_writer);
return false;
}
static void render() {
controller_state.render();
GPU::render(Shared::background);
controller_state0.render();
controller_state1.render();
FontWriter::new_font_writer.render();
Shared::back_menu.render();
}