+
+
+void KeyGrabber::CheckGamepad(void)
+{
+ // How do we determine which joystick it is, if more than one? As it turns
+ // out, we don't really have to care. It's up to the user to play nice with
+ // the interface because while we can enforce a 'first user to press a
+ // button wins' type of thing, it doesn't really buy you anything that you
+ // couldn't get by having the users involved behave like nice people. :-P
+ Gamepad::Update();
+
+ if (!buttonDown)
+ {
+ button = Gamepad::CheckButtonPressed();
+
+ if (button == -1)
+ return;
+
+// Do it so that it sets the button on button down, not release :-P
+ key = button;
+ accept();
+ buttonDown = true;
+ }
+ else
+ {
+ if (Gamepad::CheckButtonPressed() == button)
+ return;
+
+// key = button;
+// accept();
+ buttonDown = false;
+ }
+}
+