mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-24 21:56:53 +01:00
Use left/right to jump a full page on the toplevel menu. (#84)
* Allow using dpad left/right to navigate a whole page up or down, in the toplevel menu. * Wrap around when paging up/down at the top/bottom. * Cosmetic code change, and no wrap-around while paging. --------- Co-authored-by: Daniel K. O. (dkosmari) <none@none>
This commit is contained in:
parent
87bb3c521f
commit
5893ac2f18
@ -27,7 +27,7 @@ void ConfigRenderer::RenderStateMain() const {
|
|||||||
// draw bottom bar
|
// draw bottom bar
|
||||||
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
||||||
DrawUtils::setFontSize(18);
|
DrawUtils::setFontSize(18);
|
||||||
DrawUtils::print(16, SCREEN_HEIGHT - 10, "\ue07d Navigate ");
|
DrawUtils::print(16, SCREEN_HEIGHT - 10, "\ue07d/\ue07e Navigate ");
|
||||||
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, "\ue000 Select", true);
|
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, "\ue000 Select", true);
|
||||||
|
|
||||||
// draw scroll indicator
|
// draw scroll indicator
|
||||||
@ -71,9 +71,21 @@ ConfigSubState ConfigRenderer::UpdateStateMain(const Input &input) {
|
|||||||
}
|
}
|
||||||
auto prevSelectedItem = mCursorPos;
|
auto prevSelectedItem = mCursorPos;
|
||||||
|
|
||||||
auto totalElementSize = mConfigs.size();
|
auto totalElementSize = (int32_t) mConfigs.size();
|
||||||
if (input.data.buttons_d & Input::eButtons::BUTTON_DOWN) {
|
if (input.data.buttons_d & Input::eButtons::BUTTON_DOWN) {
|
||||||
mCursorPos++;
|
mCursorPos++;
|
||||||
|
} else if (input.data.buttons_d & Input::eButtons::BUTTON_LEFT) {
|
||||||
|
// Paging up
|
||||||
|
mCursorPos -= MAX_BUTTONS_ON_SCREEN - 1;
|
||||||
|
// Don't jump past the top
|
||||||
|
if (mCursorPos < 0)
|
||||||
|
mCursorPos = 0;
|
||||||
|
} else if (input.data.buttons_d & Input::eButtons::BUTTON_RIGHT) {
|
||||||
|
// Paging down
|
||||||
|
mCursorPos += MAX_BUTTONS_ON_SCREEN - 1;
|
||||||
|
// Don't jump past the bottom
|
||||||
|
if (mCursorPos >= totalElementSize)
|
||||||
|
mCursorPos = totalElementSize - 1;
|
||||||
} else if (input.data.buttons_d & Input::eButtons::BUTTON_UP) {
|
} else if (input.data.buttons_d & Input::eButtons::BUTTON_UP) {
|
||||||
mCursorPos--;
|
mCursorPos--;
|
||||||
} else if (input.data.buttons_d & Input::eButtons::BUTTON_A) {
|
} else if (input.data.buttons_d & Input::eButtons::BUTTON_A) {
|
||||||
@ -95,8 +107,8 @@ ConfigSubState ConfigRenderer::UpdateStateMain(const Input &input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mCursorPos < 0) {
|
if (mCursorPos < 0) {
|
||||||
mCursorPos = (int32_t) totalElementSize - 1;
|
mCursorPos = totalElementSize - 1;
|
||||||
} else if (mCursorPos > (int32_t) (totalElementSize - 1)) {
|
} else if (mCursorPos > totalElementSize - 1) {
|
||||||
mCursorPos = 0;
|
mCursorPos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user