jabyengine/examples/PoolBox/application/src/Overlay/ControllerTest/controller_test.cpp

44 lines
1.2 KiB
C++

#include "../../../include/shared.hpp"
#include "../../include/font_writer.hpp"
#include "include/controller_state.hpp"
#include <PSX/Periphery/periphery.hpp>
#include <stdio.h>
namespace ControllerTest {
using namespace JabyEngine;
static auto controller_state = ControllerState::create();
static void setup() {
Shared::back_menu.reset();
controller_state.setup();
}
static bool update_or_exit() {
Periphery::query_controller();
if(Shared::back_menu.update(Make::PositionI16(0, GPU::Display::Height - 32))) {
return true;
}
controller_state.update(Periphery::get_primary_controller_as<JabyEngine::Periphery::AnalogeController>(), FontWriter::new_font_writer);
return false;
}
static void render() {
controller_state.render();
FontWriter::new_font_writer.render();
Shared::back_menu.render();
}
void main() {
setup();
while(true) {
if(update_or_exit()) {
break;
}
GPU::swap_buffers_vsync(1);
render();
}
}
}