Implemented SDL_GetAbsoluteMouseState().

X11 only for now, but this should be doable on every platform, I think.
This commit is contained in:
Ryan C. Gordon
2014-06-05 00:03:33 -04:00
parent 264eb4bbed
commit b861efde14
7 changed files with 101 additions and 0 deletions

View File

@@ -1488,6 +1488,19 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
}
}
break;
case SDLK_a:
if (withControl) {
/* Ctrl-A reports absolute mouse position. */
int x, y;
const Uint32 mask = SDL_GetAbsoluteMouseState(&x, &y);
SDL_Log("ABSOLUTE MOUSE: (%d, %d)%s%s%s%s%s\n", x, y,
(mask & SDL_BUTTON_LMASK) ? " [LBUTTON]" : "",
(mask & SDL_BUTTON_MMASK) ? " [MBUTTON]" : "",
(mask & SDL_BUTTON_RMASK) ? " [RBUTTON]" : "",
(mask & SDL_BUTTON_X1MASK) ? " [X2BUTTON]" : "",
(mask & SDL_BUTTON_X2MASK) ? " [X2BUTTON]" : "");
}
break;
case SDLK_0:
if (withControl) {
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);