mirror of https://github.com/mgba-emu/mgba.git
GUI: Use the real page size for page scrolling
This commit is contained in:
parent
87a05e3ed1
commit
d5697971a9
|
@ -85,6 +85,12 @@ bool selectFile(const struct GUIParams* params, const char* basePath, char* outP
|
||||||
}
|
}
|
||||||
size_t fileIndex = 0;
|
size_t fileIndex = 0;
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
|
size_t pageSize = params->height / GUIFontHeight(params->font);
|
||||||
|
if (pageSize > 4) {
|
||||||
|
pageSize -= 4;
|
||||||
|
} else {
|
||||||
|
pageSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
struct FileList currentFiles;
|
struct FileList currentFiles;
|
||||||
FileListInit(¤tFiles, 0);
|
FileListInit(¤tFiles, 0);
|
||||||
|
@ -113,15 +119,15 @@ bool selectFile(const struct GUIParams* params, const char* basePath, char* outP
|
||||||
++fileIndex;
|
++fileIndex;
|
||||||
}
|
}
|
||||||
if (newInput & (1 << GUI_INPUT_LEFT)) {
|
if (newInput & (1 << GUI_INPUT_LEFT)) {
|
||||||
if (fileIndex >= ITERATION_SIZE) {
|
if (fileIndex >= pageSize) {
|
||||||
fileIndex -= ITERATION_SIZE;
|
fileIndex -= pageSize;
|
||||||
} else {
|
} else {
|
||||||
fileIndex = 0;
|
fileIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newInput & (1 << GUI_INPUT_RIGHT)) {
|
if (newInput & (1 << GUI_INPUT_RIGHT)) {
|
||||||
if (fileIndex + ITERATION_SIZE < FileListSize(¤tFiles)) {
|
if (fileIndex + pageSize < FileListSize(¤tFiles)) {
|
||||||
fileIndex += ITERATION_SIZE;
|
fileIndex += pageSize;
|
||||||
} else {
|
} else {
|
||||||
fileIndex = FileListSize(¤tFiles) - 1;
|
fileIndex = FileListSize(¤tFiles) - 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue