1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Corrects SDL mouse button up/down capture.

This commit is contained in:
Thomas Harte 2019-07-09 16:32:38 -04:00
parent 52e96e3d2a
commit 96be1a3f62

View File

@ -736,15 +736,16 @@ int main(int argc, char *argv[]) {
case SDL_MOUSEBUTTONUP: {
const auto mouse_machine = machine->mouse_machine();
if(mouse_machine) {
printf("%d %s\n", event.button.button, (event.type == SDL_PRESSED) ? "pressed" : "released");
printf("%d %s\n", event.button.button, (event.type == SDL_MOUSEBUTTONDOWN) ? "pressed" : "released");
mouse_machine->get_mouse().set_button_pressed(
event.button.button % mouse_machine->get_mouse().get_number_of_buttons(),
event.type == SDL_PRESSED);
event.type == SDL_MOUSEBUTTONDOWN);
}
} break;
case SDL_MOUSEMOTION: {
if(SDL_GetRelativeMouseMode()) {
printf("-> %d %d (%d %d)\n", event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel);
const auto mouse_machine = machine->mouse_machine();
if(mouse_machine) {
mouse_machine->get_mouse().move(event.motion.xrel, event.motion.yrel);