do not register wiimote 'mouse' clicks when the wiimote is not pointed at the screen

This commit is contained in:
dborth 2009-06-28 18:29:09 +00:00
parent 4b6ed2fd71
commit 5a1a5a42b4

View file

@ -33,13 +33,10 @@
#include "SDL_wiivideo.h" #include "SDL_wiivideo.h"
#include "SDL_wiievents_c.h" #include "SDL_wiievents_c.h"
int lastX = 0; static int lastX = 0;
int lastY = 0; static int lastY = 0;
Uint8 lastButtonStateA = SDL_RELEASED; static Uint8 lastButtonStateA = SDL_RELEASED;
Uint8 lastButtonStateB = SDL_RELEASED; static Uint8 lastButtonStateB = SDL_RELEASED;
Uint8 lastButtonStateLeftMouse = SDL_RELEASED;
Uint8 lastButtonStateRightMouse = SDL_RELEASED;
static SDLKey keymap[512]; static SDLKey keymap[512];
@ -78,10 +75,10 @@ void PumpEvents()
lastX = x; lastX = x;
lastY = y; lastY = y;
} }
}
Uint8 stateA = SDL_RELEASED; Uint8 stateA = SDL_RELEASED;
Uint8 stateB = SDL_RELEASED; Uint8 stateB = SDL_RELEASED;
if (wd->btns_h & WPAD_BUTTON_A) if (wd->btns_h & WPAD_BUTTON_A)
{ {
stateA = SDL_PRESSED; stateA = SDL_PRESSED;
@ -101,6 +98,7 @@ void PumpEvents()
lastButtonStateB = stateB; lastButtonStateB = stateB;
posted += SDL_PrivateMouseButton(stateB, SDL_BUTTON_RIGHT, x, y); posted += SDL_PrivateMouseButton(stateB, SDL_BUTTON_RIGHT, x, y);
} }
}
if (stat && (ke.type == KEYBOARD_RELEASED || ke.type == KEYBOARD_PRESSED)) if (stat && (ke.type == KEYBOARD_RELEASED || ke.type == KEYBOARD_PRESSED))
{ {