mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Adds a potential workaround for SDL mouse motion.
This commit is contained in:
parent
96be1a3f62
commit
f73bccfec8
@ -736,7 +736,6 @@ int main(int argc, char *argv[]) {
|
|||||||
case SDL_MOUSEBUTTONUP: {
|
case SDL_MOUSEBUTTONUP: {
|
||||||
const auto mouse_machine = machine->mouse_machine();
|
const auto mouse_machine = machine->mouse_machine();
|
||||||
if(mouse_machine) {
|
if(mouse_machine) {
|
||||||
printf("%d %s\n", event.button.button, (event.type == SDL_MOUSEBUTTONDOWN) ? "pressed" : "released");
|
|
||||||
mouse_machine->get_mouse().set_button_pressed(
|
mouse_machine->get_mouse().set_button_pressed(
|
||||||
event.button.button % mouse_machine->get_mouse().get_number_of_buttons(),
|
event.button.button % mouse_machine->get_mouse().get_number_of_buttons(),
|
||||||
event.type == SDL_MOUSEBUTTONDOWN);
|
event.type == SDL_MOUSEBUTTONDOWN);
|
||||||
@ -745,7 +744,12 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
case SDL_MOUSEMOTION: {
|
case SDL_MOUSEMOTION: {
|
||||||
if(SDL_GetRelativeMouseMode()) {
|
if(SDL_GetRelativeMouseMode()) {
|
||||||
printf("-> %d %d (%d %d)\n", event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel);
|
// This is a workaround; using motion.xrel and motion.yrel from the event doesn't
|
||||||
|
// appear to work consistently.
|
||||||
|
int xrel, yrel;
|
||||||
|
SDL_GetRelativeMouseState(&xrel, &yrel);
|
||||||
|
|
||||||
|
printf("-> %d %d (%d %d / %d %d)\n", event.motion.x, event.motion.y, event.motion.xrel, event.motion.yrel, xrel, yrel);
|
||||||
const auto mouse_machine = machine->mouse_machine();
|
const auto mouse_machine = machine->mouse_machine();
|
||||||
if(mouse_machine) {
|
if(mouse_machine) {
|
||||||
mouse_machine->get_mouse().move(event.motion.xrel, event.motion.yrel);
|
mouse_machine->get_mouse().move(event.motion.xrel, event.motion.yrel);
|
||||||
|
Loading…
Reference in New Issue
Block a user