MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / OnInput

Method OnInput

projects/uMenu/source/ul/menu/ui/ui_EntryMenu.cpp:492–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490 }
491
492 void EntryMenu::OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const pu::ui::TouchPoint touch_pos) {
493 if(this->IsCursorInTransition()) {
494 return;
495 }
496 if(!this->enabled) {
497 return;
498 }
499
500 const auto cursor_transition_abs_incr_x = this->entry_h_margin + this->entry_size;
501 const auto cursor_transition_abs_incr_y = EntryVerticalMargin + this->entry_size;
502
503 if((keys_down & HidNpadButton_Up) || (keys_held & HidNpadButton_StickLUp) || (keys_held & HidNpadButton_StickRUp)) {
504 const auto cur_entry_idx_y = this->cur_entry_idx % g_EntryHeightCount;
505
506 if(cur_entry_idx_y > 0) {
507 if(this->IsNotInLargeSwipe()) {
508 this->pre_transition_entry_idx = this->cur_entry_idx;
509 this->after_transition_entry_idx = this->cur_entry_idx - 1;
510 this->cursor_transition_y_incr.Start(CursorTransitionIncrementSteps, 0, -cursor_transition_abs_incr_y);
511 this->cur_entry_change_started_cb();
512 }
513 }
514 }
515 else if((keys_down & HidNpadButton_Down) || (keys_held & HidNpadButton_StickLDown) || (keys_held & HidNpadButton_StickRDown)) {
516 const auto cur_entry_idx_y = this->cur_entry_idx % g_EntryHeightCount;
517 if((cur_entry_idx_y + 1) < g_EntryHeightCount) {
518 if(this->IsNotInLargeSwipe()) {
519 this->pre_transition_entry_idx = this->cur_entry_idx;
520 this->after_transition_entry_idx = this->cur_entry_idx + 1;
521 this->cursor_transition_y_incr.Start(CursorTransitionIncrementSteps, 0, cursor_transition_abs_incr_y);
522 this->cur_entry_change_started_cb();
523 }
524 }
525 }
526 else if((keys_down & HidNpadButton_Left) || (keys_held & HidNpadButton_StickLLeft) || (keys_held & HidNpadButton_StickRLeft)) {
527 const auto rel_entry_idx_x = (this->cur_entry_idx / g_EntryHeightCount) - this->base_entry_idx_x;
528 if(rel_entry_idx_x > 0) {
529 if(this->IsNotInLargeSwipe()) {
530 this->pre_transition_entry_idx = this->cur_entry_idx;
531 this->after_transition_entry_idx = this->cur_entry_idx - g_EntryHeightCount;
532 this->cursor_transition_x_incr.Start(CursorTransitionIncrementSteps, 0, -cursor_transition_abs_incr_x);
533 this->cur_entry_change_started_cb();
534 }
535 }
536 else if((rel_entry_idx_x == 0) && (this->base_entry_idx_x > 0)) {
537 if(this->IsNotInSwipe()) {
538 this->SwipeSingleLeft();
539
540 this->entries_base_swipe_neg_offset = this->entry_size + this->entry_h_margin /* x1 */;
541 this->entries_base_swipe_neg_offset_incr.StartToZero(EntriesSwipeSingleIncrementSteps, this->entries_base_swipe_neg_offset);
542 this->swipe_mode = SwipeMode::LeftSingle;
543 }
544 }
545 }
546 else if((keys_down & HidNpadButton_Right) || (keys_held & HidNpadButton_StickLRight) || (keys_held & HidNpadButton_StickRRight)) {
547 const auto rel_entry_idx_x = (this->cur_entry_idx / g_EntryHeightCount) - this->base_entry_idx_x;
548 if((rel_entry_idx_x + 1) < this->entry_width_count) {
549 if(this->IsNotInLargeSwipe()) {

Callers

nothing calls this directly

Calls 4

IsCursorInTransitionMethod · 0.95
IsNotInLargeSwipeMethod · 0.95
IsNotInSwipeMethod · 0.95
SwipeSingleLeftMethod · 0.95

Tested by

no test coverage detected