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_POW, 1.0, 1},
62 {
HM_ATT_CLUTCH, {3,
GFCTRL_TYPE_MOUSE_BUT}, 0,
HM_ATT_CLUTCH_MIN, 0,
HM_ATT_CLUTCH_MAX, 0,
HM_ATT_CLUTCH_POW, 1.0, 1},
63 {
HM_ATT_ASR_CMD, {-1,
GFCTRL_TYPE_NOT_AFFECTED}, 0, 0, 0, 0, 0, 0, 0, 1},
64 {
HM_ATT_ABS_CMD, {-1,
GFCTRL_TYPE_NOT_AFFECTED}, 0, 0, 0, 0, 0, 0, 0, 1},
65 {
HM_ATT_SPDLIM_CMD, {-1,
GFCTRL_TYPE_NOT_AFFECTED}, 0, 0, 0, 0, 0, 0, 0, 1}
107 const int BUFSIZE = 10;
112 if (sscanf(val,
"%f", &fv) == 1) {
113 snprintf(buf, BUFSIZE,
"%6.4f", fv);
114 editBoxValue->
value = fv;
128 for (i = 0; i <
maxCmd; i++) {
136 if (
Cmd[i].minName) {
140 if (
Cmd[i].maxName) {
144 if (
Cmd[i].powName) {
168 const int BUFSIZE = 1024;
171 for (i = 0; i <
maxCmd; i++) {
260 for (i = 0; i < _JS_MAX_AXES *
NUM_JOY; i++) {
285 for (index = 0; index <
NUM_JOY; index++) {
288 for (i = 0, mask = 1; i < 32; i++, mask *= 2) {
289 if (((b[index] & mask) != 0) && ((
rawb[index] & mask) == 0)) {
303 rawb[index] = b[index];
309 rawb[index] = b[index];
342 for (i = 0; i < 3; i++) {
356 for (i = 0; i < 4; i++) {
370 for (index = 0; index <
NUM_JOY; index++) {
372 js[index]->read(&b[index], &
ax[index * _JS_MAX_AXES]);
377 const double delay = 0.2;
418 for (index = 0; index <
NUM_JOY; index++) {
420 js[index]->read(&
rawb[index], &
ax[index * _JS_MAX_AXES]);
431 const int BUFSIZE = 1024;
439 for (cmd = 0; cmd <
maxCmd; cmd++) {
449 if (
Cmd[cmd].minName) {
454 if (
Cmd[cmd].maxName) {
459 if (
Cmd[cmd].powName) {
473 for (cmd = 0; cmd <
maxCmd; cmd++) {
496 const int BUFSIZE = 1024;
510 for (index = 0; index <
NUM_JOY; index++) {
511 if (
js[index] == NULL) {
512 js[index] =
new jsJoystick(index);
515 if (
js[index]->notWorking()) {
533 for (i = 0; i <
maxCmd; i++) {
538 if (i == (
maxCmd / 2 - 1)) {
Scalar min(Scalar x, Scalar y)
Scalar max(Scalar x, Scalar y)
const char * GfctrlGetDefaultSection(GfCtrlType type)
void * TorcsControlMenuInit(void *prevMenu, int idx)
static EditboxValue editBoxValues[]
static int onKeyAction(unsigned char key, int, int state)
static bool isAxisPreffered(tCmdInfo *cmd)
static int MouseCalButton
static int onSKeyAction(int key, int, int state)
static const int IDX_BRAKE_POW
static const int CURRENTSECTIONSIZE
static jsJoystick * js[NUM_JOY]
static int getMovedAxis(void)
static void onPush(tCmdInfo *cmdInfo)
static float axCenter[_JS_MAX_AXES *NUM_JOY]
static float ax[_JS_MAX_AXES *NUM_JOY]
static char CurrentSection[CURRENTSECTIONSIZE]
static void onActivate(void)
static void onFocusLost(void)
static void onValueChange(EditboxValue *editBoxValue)
static tCtrlMouseInfo mouseInfo
static tCmdInfo * CurrentCmd
static const int IDX_LEFTSTEER_POW
static bool checkJoystickMovedAxis(tCmdInfo *cmd)
static void DevCalibrate(void *menu)
static double axisPressedTime
static bool checkJoystickButtonPressed(tCmdInfo *cmd, int b[], bool checkOnly)
static const int nbEditboxValues
static void updateButtonText(void)
int GfctrlMouseGetCurrent(tCtrlMouseInfo *mouseInfo)
Get the mouse current values.
void GfctrlGetRefByName(const char *name, tCtrlRef *ref)
Get a control reference by its name.
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 GfctrlMouseInitCenter(void)
Get the reference position.
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.
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
void GfuiAddKeyAction(void *scr, unsigned char key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
Add a Keyboard callback to a screen.
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
int GfuiEditboxCreateAction(void *scr, const char *text, int font, int x, int y, int width, int maxlen, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost, int margin)
Add an edit box to a screen.
void GfuiIdle(void)
Process held-mouse-button repeat actions on the active screen.
int GfuiVisibilitySet(void *scr, int id, int visible)
Set/unset the visibility attribute of an object.
void GfuiButtonSetText(void *scr, int id, const char *text)
Change the label of a button.
void GfuiEditboxSetString(void *scr, int id, const char *text)
Set a new string.
char * GfuiEditboxGetString(void *scr, int id)
Get the current text of an edit box.
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
void GfuiKeyEventRegister(void *scr, tfuiKeyCallback onKeyAction)
Set the ordinary-key event interceptor for a screen.
int GfuiButtonStateCreateAction(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)
Create a text button that toggles between pressed and released while focused.
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
void GfuiSKeyEventRegister(void *scr, tfuiSKeyCallback onSKeyAction)
Set the special-key event interceptor for a screen.
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.
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
int GfParmSetStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle.
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle.
int GfParmWriteFile(const char *file, void *parmHandle, const char *name)
Write parameter set into file.
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
void * JoyCalMenuInit(void *prevMenu, tCmdInfo *cmd, int maxcmd, void *parmhandle, const char *driversection)
void * MouseCalMenuInit(void *prevMenu, tCmdInfo *cmd, int maxcmd)
double GfTimeClock(void)
Get the time in seconds.
#define HM_ATT_RIGHTSTEER
#define HM_ATT_LEFTSTEER_POW
#define HM_ATT_THROTTLE_MAX
#define HM_ATT_BRAKE_TOREAR
#define HM_ATT_STEER_DEAD
#define HM_ATT_RIGHTSTEER_MAX
#define HM_ATT_STEER_SENS
#define HM_ATT_BRAKE_TOFRONT
#define HM_ATT_LIGHT1_CMD
#define HM_ATT_LEFTSTEER_MIN
#define HM_ATT_RIGHTSTEER_POW
#define HM_ATT_CLUTCH_MIN
#define HM_ATT_RIGHTSTEER_MIN
#define HM_ATT_CLUTCH_MAX
#define HM_ATT_THROTTLE_SENS
#define HM_ATT_THROTTLE_MIN
#define HM_ATT_LEFTSTEER_MAX
#define HM_ATT_SPDLIM_CMD
#define HM_ATT_THROTTLE_POW
#define HM_SECT_MOUSEPREF
#define HM_ATT_CLUTCH_POW
#define HM_ATT_BRAKE_SENS
#define HM_ATT_CLUTCH_SENS
Mouse information structure.
#define GFPARM_RMODE_CREAT
Allow an empty in-memory set on file-open failure; does not write a file.
#define GFPARM_RMODE_STD
Return a new handle sharing cached data for this filename, if available.
#define GFUI_INVISIBLE
Object invisibility flag.
@ GFCTRL_TYPE_NOT_AFFECTED
#define GFUI_FONT_MEDIUM_C
std::function< void()> tGfuiAction
#define GFUI_VISIBLE
Object visibility flag.