26#include <playerpref.h>
27#include <portability.h>
55 "Center the joystick then press a button for more than 0.2s",
56 "Steer left then press a button for more than 0.2s",
57 "Steer right then press a button for more than 0.2s",
58 "Apply full throttle then press a button for more than 0.2s",
59 "Apply full brake then press a button for more than 0.2s",
60 "Apply full clutch then press a button for more than 0.2s",
61 "Calibration successfully done",
68static const char *
LabName[] = {
"Steer",
"Throttle",
"Brake",
"Clutch" };
87 const int BUFSIZE = 1024;
102 snprintf(buf, BUFSIZE,
"%.2g",
ax[axis]);
111 snprintf(buf, BUFSIZE,
"%.2g",
ax[axis]);
122 snprintf(buf, BUFSIZE,
"%.2g",
axCenter[axis]);
124 snprintf(buf, BUFSIZE,
"%.2g",
ax[axis]);
139 const double delay = 0.2;
141 for (index = 0; index <
NUM_JOY; index++) {
143 js[index]->read(&b, &
ax[index * _JS_MAX_AXES]);
147 for (i = 0, mask = 1; i < 32; i++, mask *= 2) {
148 if (((b & mask) != 0) && ((
rawb[index] & mask) == 0)) {
186 for (index = 0; index <
NUM_JOY; index++) {
188 js[index]->read(&
rawb[index], &
ax[index * _JS_MAX_AXES]);
194 for (i = 0; i < 4; i++) {
213 int x,
y, dy, i, index;
234 for (i = 0; i < 4; i++) {
242 for (index = 0; index <
NUM_JOY; index++) {
243 if (
js[index] == NULL) {
244 js[index] =
new jsJoystick(index);
247 if (
js[index]->notWorking()) {
static jsJoystick * js[NUM_JOY]
static float axCenter[_JS_MAX_AXES *NUM_JOY]
static float ax[_JS_MAX_AXES *NUM_JOY]
static void onActivate(void)
static double axisPressedTime
const char * GfctrlGetNameByRef(GfCtrlType type, int index)
Get a control name by its reference.
bool GfctrlIsEventBlacklisted(void *parmHandle, const char *driversSection, const char *event)
Check if given event is blacklisted (used for buttons or axis which fire a button AND move event).
void * GfuiScreenCreateExAction(float *bgColor, const tGfuiAction &onActivate, const tGfuiAction &onDeactivate, int mouseAllowed)
Create a screen.
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
void GfuiLabelSetText(void *scr, int id, const char *text)
Change the text of a label.
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
void GfuiIdle(void)
Process held-mouse-button repeat actions on the active screen.
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
int GfuiButtonCreateAction(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Add a button to a screen.
static const char * Instructions[]
static const char * LabName[]
static void advanceStep(void)
static const char * driverSection
static void onActivate(void)
static void JoyCalAutomaton(void)
void * JoyCalMenuInit(void *prevMenu, tCmdInfo *cmd, int maxcmd, void *parmhandle, const char *driversection)
double GfTimeClock(void)
Get the time in seconds.
Parameter set handle structure, multiple handles can reference the same parameter set.
std::function< void()> tGfuiAction