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T_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}
108 const int BUFSIZE = 10;
113 if (sscanf(val,
"%f", &fv) == 1) {
114 snprintf(buf, BUFSIZE,
"%6.4f", fv);
115 editBoxValue->
value = fv;
129 for (i = 0; i <
maxCmd; i++) {
137 if (
Cmd[i].minName) {
141 if (
Cmd[i].maxName) {
145 if (
Cmd[i].powName) {
169 const int BUFSIZE = 1024;
172 for (i = 0; i <
maxCmd; i++) {
261 for (i = 0; i < _JS_MAX_AXES *
NUM_JOY; i++) {
286 for (index = 0; index <
NUM_JOY; index++) {
289 for (i = 0, mask = 1; i < 32; i++, mask *= 2) {
290 if (((b[index] & mask) != 0) && ((
rawb[index] & mask) == 0)) {
304 rawb[index] = b[index];
310 rawb[index] = b[index];
343 for (i = 0; i < 3; i++) {
357 for (i = 0; i < 4; i++) {
371 for (index = 0; index <
NUM_JOY; index++) {
373 js[index]->read(&b[index], &
ax[index * _JS_MAX_AXES]);
378 const double delay = 0.2;
419 for (index = 0; index <
NUM_JOY; index++) {
421 js[index]->read(&
rawb[index], &
ax[index * _JS_MAX_AXES]);
432 const int BUFSIZE = 1024;
440 for (cmd = 0; cmd <
maxCmd; cmd++) {
450 if (
Cmd[cmd].minName) {
455 if (
Cmd[cmd].maxName) {
460 if (
Cmd[cmd].powName) {
474 for (cmd = 0; cmd <
maxCmd; cmd++) {
497 const int BUFSIZE = 1024;
511 for (index = 0; index <
NUM_JOY; index++) {
512 if (
js[index] == NULL) {
513 js[index] =
new jsJoystick(index);
516 if (
js[index]->notWorking()) {
534 for (i = 0; i <
maxCmd; i++) {
539 if (i == (
maxCmd / 2 - 1)) {
#define HM_ATT_CLUTCH_POW
static int MouseCalButton
int GfctrlMouseGetCurrent(tCtrlMouseInfo *mouseInfo)
Get the mouse current values.
#define HM_ATT_CLUTCH_MAX
int GfParmSetStr(void *handle, const char *path, const char *key, const char *val)
Set a string parameter in the parameter set handle.
char * GfuiEditboxGetString(void *scr, int id)
Get the string.
int GfuiButtonStateCreate(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
Add a state button to a screen.
static EditboxValue editBoxValues[]
void * GfParmReadFile(const char *file, int mode)
Read parameter set from file and return handle to parameter set.
static int getMovedAxis(void)
static tCmdInfo * CurrentCmd
#define HM_ATT_STEER_SENS
int GfuiButtonCreate(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
Add a button to a screen.
Scalar max(Scalar x, Scalar y)
#define GFPARM_RMODE_STD
if handle already openned return it
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)...
static void onValueChange(void *v)
static float ax[_JS_MAX_AXES *NUM_JOY]
int edgedn[3]
Button transition from up to down.
static const int nbEditboxValues
#define HM_ATT_RIGHTSTEER_POW
#define HM_ATT_THROTTLE_POW
void GfuiAddKey(void *scr, unsigned char key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
Add a Keyboard callback to a screen.
Robot Module Interface Definition.
#define HM_ATT_THROTTLE_MAX
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
static tCtrlMouseInfo mouseInfo
#define HM_ATT_CLUTCH_SENS
int GfuiEditboxCreate(void *scr, const char *text, int font, int x, int y, int width, int maxlen, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost, int margin)
Add a editbox to a screen.
void GfuiScreenAddBgImg(void *scr, const char *filename)
Add an image background to a screen.
static float axCenter[_JS_MAX_AXES *NUM_JOY]
int GfParmWriteFile(const char *file, void *parmHandle, const char *name)
Write parameter set into file.
void GfuiIdle(void)
Idle function for the GUI to be called during Idle loop of glut.
static void onPush(void *vi)
const char * GfParmGetStr(void *parmHandle, const char *path, const char *key, const char *deflt)
Get a string parameter from the parameter set handle.
#define HM_ATT_LEFTSTEER_MAX
void GfuiSKeyEventRegister(void *scr, tfuiSKeyCallback onSKeyAction)
The Gaming Framework API (client part).
void GfuiKeyEventRegister(void *scr, tfuiKeyCallback onKeyAction)
#define HM_ATT_LEFTSTEER_MIN
static const int IDX_BRAKE_POW
#define HM_ATT_LIGHT1_CMD
static void DevCalibrate(void *menu)
void GfuiButtonSetText(void *scr, int id, const char *text)
Change the label of a button.
void * GfuiScreenCreateEx(float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
Create a screen.
static const int CURRENTSECTIONSIZE
#define HM_ATT_RIGHTSTEER
void GfuiEditboxSetString(void *scr, int id, const char *text)
Set a new string.
#define HM_ATT_BRAKE_SENS
static char CurrentSection[CURRENTSECTIONSIZE]
static void onSave(void *)
const char * GfctrlGetDefaultSection(GfCtrlType type)
static void onActivate(void *)
const char * GfctrlGetNameByRef(GfCtrlType type, int index)
Get a control name by its reference.
static void onFocusLost(void *)
void * JoyCalMenuInit(void *prevMenu, tCmdInfo *cmd, int maxcmd, void *parmhandle, const char *driversection)
static void updateButtonText(void)
static jsJoystick * js[NUM_JOY]
static bool isAxisPreffered(tCmdInfo *cmd)
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
void * MouseCalMenuInit(void *prevMenu, tCmdInfo *cmd, int maxcmd)
#define HM_ATT_THROTTLE_SENS
#define HM_ATT_THROTTLE_MIN
#define HM_SECT_MOUSEPREF
void(* tfuiCallback)(void *)
void GfctrlMouseInitCenter(void)
Get the reference position.
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
#define GFUI_INVISIBLE
Object invisibility flag.
#define HM_ATT_BRAKE_TOREAR
int GfParmSetNum(void *handle, const char *path, const char *key, const char *unit, tdble val)
Set a numerical parameter in the parameter set handle.
void GfctrlGetRefByName(const char *name, tCtrlRef *ref)
Get a control reference by its name.
tdble GfParmGetNum(void *handle, const char *path, const char *key, const char *unit, tdble deflt)
Get a numerical parameter from the parameter set handle.
double GfTimeClock(void)
Get the time in seconds.
Scalar min(Scalar x, Scalar y)
#define HM_ATT_RIGHTSTEER_MIN
static const int IDX_LEFTSTEER_POW
int GfuiTitleCreate(void *scr, const char *text, int maxlen)
Add a Title to the screen.
#define HM_ATT_LEFTSTEER_POW
void * TorcsControlMenuInit(void *prevMenu, int idx)
#define GFUI_FONT_MEDIUM_C
static int onKeyAction(unsigned char key, int, int state)
Mouse information structure.
#define HM_ATT_SPDLIM_CMD
static bool checkJoystickButtonPressed(tCmdInfo *cmd, int b[], bool checkOnly)
float ax[4]
mouse axis position (mouse considered as a joystick)
static double axisPressedTime
int GfuiVisibilitySet(void *scr, int id, int visible)
Set/unset the visibility attribute of an object.
Track Structure and Track Loader Module Definition.
#define HM_ATT_STEER_DEAD
#define HM_ATT_RIGHTSTEER_MAX
#define HM_ATT_BRAKE_TOFRONT
#define GFUI_VISIBLE
Object visibility flag.
#define GFPARM_RMODE_CREAT
Create the file if doesn't exist.
static bool checkJoystickMovedAxis(tCmdInfo *cmd)
static int onSKeyAction(int key, int, int state)
#define HM_ATT_CLUTCH_MIN