summaryrefslogtreecommitdiff
path: root/src/joystick.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/joystick.h')
-rw-r--r--src/joystick.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/joystick.h b/src/joystick.h
index 87d1e81a9..55b75d373 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -23,6 +23,8 @@
#ifndef JOYSTICK_H
#define JOYSTICK_H
+#include "inputevent.h"
+
#include <SDL.h>
#include <string>
@@ -86,7 +88,7 @@ class Joystick
/**
* Updates the direction and button information.
*/
- void update();
+ void logic();
void startCalibration();
@@ -98,16 +100,16 @@ class Joystick
bool buttonPressed(unsigned char no) const;
bool isUp() const
- { return mEnabled && (mDirection & UP); };
+ { return mEnabled && (mDirection & UP); }
bool isDown() const
- { return mEnabled && (mDirection & DOWN); };
+ { return mEnabled && (mDirection & DOWN); }
bool isLeft() const
- { return mEnabled && (mDirection & LEFT); };
+ { return mEnabled && (mDirection & LEFT); }
bool isRight() const
- { return mEnabled && (mDirection & RIGHT); };
+ { return mEnabled && (mDirection & RIGHT); }
int getNumber() const
{ return mNumber; }
@@ -115,9 +117,19 @@ class Joystick
void setUseInactive(bool b)
{ mUseInactive = b; }
+ void update();
+
+ KeysVector *getActionVector(const SDL_Event &event);
+
+ int getButtonFromEvent(const SDL_Event &event);
+
+ bool isActionActive(int index) const;
+
protected:
unsigned char mDirection;
- bool mButtons[MAX_BUTTONS];
+
+ bool mActiveButtons[MAX_BUTTONS];
+
SDL_Joystick *mJoystick;
int mUpTolerance;
@@ -131,6 +143,8 @@ class Joystick
bool mUseInactive;
bool mHaveHats;
+ KeyToActionMap mKeyToAction;
+
/**
* Is joystick support enabled.
*/