Reorganize control flow in gdCustomSelect

Fixes #198
This commit is contained in:
Alexander Batalov 2022-11-03 18:08:49 +03:00
parent b689b3a757
commit a38151bf2c

View File

@ -4104,10 +4104,7 @@ int _gdCustomSelect(int a1)
sharedFpsLimiter.mark();
int keyCode = inputGetInput();
if (keyCode == -1) {
continue;
}
if (keyCode != -1) {
if (keyCode == KEY_CTRL_Q || keyCode == KEY_CTRL_X || keyCode == KEY_F10) {
showQuitConfirmationDialog();
}
@ -4124,26 +4121,17 @@ int _gdCustomSelect(int a1)
} else if (keyCode == KEY_ESCAPE) {
done = true;
} else if (keyCode == -2) {
if ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_UP) == 0) {
continue;
}
if ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_UP) != 0) {
// No need to use mouseHitTestInWindow as these values are already
// in screen coordinates.
if (!_mouse_click_in(minX, minY, maxX, maxY)) {
continue;
}
if (_mouse_click_in(minX, minY, maxX, maxY)) {
int mouseX;
int mouseY;
mouseGetPosition(&mouseX, &mouseY);
int lineHeight = fontGetLineHeight();
int newValue = (mouseY - minY) / lineHeight;
if (newValue >= 6) {
continue;
}
if (newValue < 6) {
unsigned int timestamp = getTicks();
if (newValue == value) {
if (getTicksBetween(timestamp, v53) < 250) {
@ -4185,6 +4173,10 @@ int _gdCustomSelect(int a1)
}
v53 = timestamp;
}
}
}
}
}
renderPresent();
sharedFpsLimiter.throttle();