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

Method update

switch/source/ScriptPickerOverlay.cpp:101–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void ScriptPickerOverlay::update(const InputState& input)
102{
103 const u64 kdown = input.kDown;
104
105 if (kdown & HidNpadButton_B) {
106 me.reset();
107 return;
108 }
109
110 if (!mEntries.empty()) {
111 if (kdown & HidNpadButton_Up) {
112 mCursor = mCursor > 0 ? mCursor - 1 : (int)mEntries.size() - 1;
113 }
114 else if (kdown & HidNpadButton_Down) {
115 mCursor = mCursor < (int)mEntries.size() - 1 ? mCursor + 1 : 0;
116 }
117 if (mCursor < mScroll)
118 mScroll = mCursor;
119 else if (mCursor >= mScroll + VISIBLE)
120 mScroll = mCursor - VISIBLE + 1;
121
122 if (kdown & HidNpadButton_A) {
123 // Dismiss first: mOnPick raises the confirm overlay and captures
124 // state that outlives this overlay.
125 ScriptCatalog::Entry entry = mEntries[mCursor];
126 auto pick = mOnPick;
127 me.reset();
128 if (pick)
129 pick(entry);
130 return;
131 }
132 }
133}

Callers

nothing calls this directly

Calls 3

resetMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected