MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / update

Method update

switch/source/TitlePickerOverlay.cpp:82–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void TitlePickerOverlay::update(const InputState& input)
83{
84 const u64 kdown = input.kDown;
85
86 if (kdown & HidNpadButton_B) {
87 me.reset();
88 return;
89 }
90
91 if (!mItems.empty()) {
92 if (kdown & HidNpadButton_Up) {
93 mCursor = mCursor > 0 ? mCursor - 1 : (int)mItems.size() - 1;
94 }
95 else if (kdown & HidNpadButton_Down) {
96 mCursor = mCursor < (int)mItems.size() - 1 ? mCursor + 1 : 0;
97 }
98 if (mCursor < mScroll)
99 mScroll = mCursor;
100 else if (mCursor >= mScroll + VISIBLE)
101 mScroll = mCursor - VISIBLE + 1;
102
103 if (kdown & HidNpadButton_A) {
104 u64 id = mItems[mCursor].first;
105 // Dismiss first: mOnPick may raise its own follow-up (a keyboard),
106 // and it captures state that outlives this overlay.
107 auto pick = mOnPick;
108 me.reset();
109 if (pick)
110 pick(id);
111 return;
112 }
113 }
114}

Callers

nothing calls this directly

Calls 3

resetMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected