| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef _JSINPUT_H |
| 24 |
#define _JSINPUT_H |
| 25 |
|
| 26 |
#include <cmath> |
| 27 |
|
| 28 |
#include "jssuper.h" |
| 29 |
|
| 30 |
class jsInput { |
| 31 |
private: |
| 32 |
jsSuper *jss; |
| 33 |
bool pretty_display; |
| 34 |
float axes[_JS_MAX_AXES]; |
| 35 |
float axes_iv[MAX_JOYSTICKS][_JS_MAX_AXES]; |
| 36 |
int button_iv[MAX_JOYSTICKS]; |
| 37 |
|
| 38 |
int joystick,axis,button; |
| 39 |
bool axis_positive; |
| 40 |
|
| 41 |
float axis_threshold; |
| 42 |
|
| 43 |
public: |
| 44 |
jsInput(jsSuper *jss); |
| 45 |
~jsInput(void); |
| 46 |
|
| 47 |
inline void displayValues(bool bb) { pretty_display=bb; } |
| 48 |
|
| 49 |
int getInput(void); |
| 50 |
void findDeadBand(void); |
| 51 |
|
| 52 |
inline int getInputJoystick(void) { return joystick; } |
| 53 |
inline int getInputAxis(void) { return axis; } |
| 54 |
inline int getInputButton(void) { return button; } |
| 55 |
inline bool getInputAxisPositive(void) { return axis_positive; } |
| 56 |
|
| 57 |
inline float getReturnThreshold(void) { return axis_threshold; } |
| 58 |
inline void setReturnThreshold(float ff) |
| 59 |
{ if(fabs(ff) <= 1.0) axis_threshold=ff; } |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
#endif |