only wrap on a new press not a repeat

This commit is contained in:
Shaun Inman 2023-01-28 20:08:08 -05:00
parent 54e1590c0f
commit 103e21d54a

View file

@ -1256,28 +1256,38 @@ int main (int argc, char *argv[]) {
if (total>0) { if (total>0) {
if (PAD_justRepeated(BTN_UP)) { if (PAD_justRepeated(BTN_UP)) {
selected -= 1; if (selected==0 && !PAD_justPressed(BTN_UP)) {
if (selected<0) { // stop at top
selected = total-1;
int start = total - MAIN_ROW_COUNT;
top->start = (start<0) ? 0 : start;
top->end = total;
} }
else if (selected<top->start) { else {
top->start -= 1; selected -= 1;
top->end -= 1; if (selected<0) {
selected = total-1;
int start = total - MAIN_ROW_COUNT;
top->start = (start<0) ? 0 : start;
top->end = total;
}
else if (selected<top->start) {
top->start -= 1;
top->end -= 1;
}
} }
} }
else if (PAD_justRepeated(BTN_DOWN)) { else if (PAD_justRepeated(BTN_DOWN)) {
selected += 1; if (selected==total-1 && !PAD_justPressed(BTN_DOWN)) {
if (selected>=total) { // stop at bottom
selected = 0;
top->start = 0;
top->end = (total<MAIN_ROW_COUNT) ? total : MAIN_ROW_COUNT;
} }
else if (selected>=top->end) { else {
top->start += 1; selected += 1;
top->end += 1; if (selected>=total) {
selected = 0;
top->start = 0;
top->end = (total<MAIN_ROW_COUNT) ? total : MAIN_ROW_COUNT;
}
else if (selected>=top->end) {
top->start += 1;
top->end += 1;
}
} }
} }
if (PAD_justRepeated(BTN_LEFT)) { if (PAD_justRepeated(BTN_LEFT)) {