Integrate all the progress into master #6
|
@ -28,6 +28,13 @@ namespace ControllerTest {
|
|||
sprt->tex_offset.y = is_active ? 16 : 0;
|
||||
}
|
||||
|
||||
static void set_active(GPU::POLY_FT4::Linked& poly, bool is_active) {
|
||||
poly->tex_offset0.y = is_active ? 16 : 0;
|
||||
poly->tex_offset1.y = is_active ? 16 : 0;
|
||||
poly->tex_offset2.y = is_active ? 32 : 16;
|
||||
poly->tex_offset3.y = is_active ? 32 : 16;
|
||||
}
|
||||
|
||||
void ControllerState :: setup() {
|
||||
for(size_t n = 0; n < 2; n++) {
|
||||
link_array(link_array(&this->tex_page[n], this->buttons[n]), this->arrows[n]);
|
||||
|
@ -39,11 +46,20 @@ namespace ControllerTest {
|
|||
DigitalButton::Triangle, DigitalButton::Circle, DigitalButton::Cross, DigitalButton::Square,
|
||||
DigitalButton::ST, DigitalButton::SEL, DigitalButton::L1, DigitalButton::L2, DigitalButton::R1, DigitalButton::R2
|
||||
};
|
||||
static const DigitalButton ArrowPolyMap[] = {
|
||||
DigitalButton::Up, DigitalButton::Right, DigitalButton::Down, DigitalButton::Left
|
||||
};
|
||||
|
||||
auto& cur_button_sprts = this->buttons[GPU::update_id()];
|
||||
auto& cur_arrow_poly = this->arrows[GPU::update_id()];
|
||||
|
||||
for(size_t n = 0; n < sizeof(ButtonSprtMap)/sizeof(ButtonSprtMap[0]); n++) {
|
||||
set_active(cur_button_sprts[n], controller.button.is_down(ButtonSprtMap[n]));
|
||||
}
|
||||
for(size_t n = 0; n < sizeof(ArrowPolyMap)/sizeof(ArrowPolyMap[0]); n++) {
|
||||
set_active(cur_arrow_poly[n], controller.button.is_down(ArrowPolyMap[n]));
|
||||
}
|
||||
|
||||
set_active(cur_button_sprts[12], controller.header.state == Periphery::RawController::State::Disconnected);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Menu {
|
|||
this->waiting = false;
|
||||
}
|
||||
|
||||
bool update(const GPU::PositionI16& position);
|
||||
bool update(const GPU::PositionI16& position, bool auto_clear = true);
|
||||
void render();
|
||||
};
|
||||
}
|
|
@ -46,7 +46,7 @@ namespace Menu {
|
|||
this->waiting = false;
|
||||
}
|
||||
|
||||
bool BackMenu :: update(const GPU::PositionI16& position) {
|
||||
bool BackMenu :: update(const GPU::PositionI16& position, bool auto_clear) {
|
||||
const auto& controller = Periphery::get_primary_controller_as<JabyEngine::Periphery::GenericController>();
|
||||
|
||||
if(controller.button.is_down(DigitalButton::Circle)) {
|
||||
|
@ -66,7 +66,7 @@ namespace Menu {
|
|||
this->font_writer->write(state, "Press and hold ()\nto get back", GPU::Color24::Red(0xD0));
|
||||
}
|
||||
|
||||
else {
|
||||
else if(auto_clear) {
|
||||
this->font_writer->clear();
|
||||
}
|
||||
return false;
|
||||
|
|
BIN
examples/PoolBox/assets/Controller.png (Stored with Git LFS)
BIN
examples/PoolBox/assets/Controller.png (Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue