TORCS  1.3.9
The Open Racing Car Simulator
Control Device Management API

This is the API to use control devices (Keyboard, mouse and joysticks). More...

Functions

void GfctrlGetRefByName (const char *name, tCtrlRef *ref)
 Get a control reference by its name. More...
 
const char * GfctrlGetNameByRef (GfCtrlType type, int index)
 Get a control name by its reference. More...
 
tCtrlJoyInfoGfctrlJoyInit (void)
 Initialize the joystick control. More...
 
void GfctrlJoyRelease (tCtrlJoyInfo *joyInfo)
 Release the tCtrlJoyInfo structure. More...
 
int GfctrlJoyIsPresent (void)
 Check if a joystick is present. More...
 
int GfctrlJoyGetCurrent (tCtrlJoyInfo *joyInfo)
 Get the joystick current values. More...
 
tCtrlMouseInfoGfctrlMouseInit (void)
 Initialize the mouse control. More...
 
void GfctrlMouseRelease (tCtrlMouseInfo *mouseInfo)
 Release the tCtrlMouseInfo structure. More...
 
int GfctrlMouseGetCurrent (tCtrlMouseInfo *mouseInfo)
 Get the mouse current values. More...
 
void GfctrlMouseCenter (void)
 Recentre the mouse on the screen. More...
 
void GfctrlMouseInitCenter (void)
 Get the reference position. More...
 
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). More...
 
void GfuiMouseSetHWPresent (void)
 Force the hardware mouse pointer. More...
 

Detailed Description

This is the API to use control devices (Keyboard, mouse and joysticks).

Function Documentation

◆ GfctrlGetNameByRef()

const char* GfctrlGetNameByRef ( GfCtrlType  type,
int  index 
)

Get a control name by its reference.

Parameters
typetype of control
indexreference index
Returns
pointer on a static structure tCtrlRef

Definition at line 191 of file control.cpp.

◆ GfctrlGetRefByName()

void GfctrlGetRefByName ( const char *  name,
tCtrlRef ref 
)

Get a control reference by its name.

Parameters
namename of the control
refPointer to tCtrlRef to fill in
See also
tCtrlRef

Definition at line 123 of file control.cpp.

◆ GfctrlIsEventBlacklisted()

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).

Parameters
parmHandleParameters containing the blacklist
driversSectionSpecific parameter section
eventName of the event, usually obtaned with GfctrlGetRefByName, e.g. "BTN7-0"
Returns
true if blacklisted, false otherwise

Definition at line 502 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlJoyGetCurrent()

int GfctrlJoyGetCurrent ( tCtrlJoyInfo joyInfo)

Get the joystick current values.

Parameters
joyInfojoystick structure
Returns
0 ... Ok
-1 .. Error
Note
The tCtrlJoyInfo structure is updated with the new values

Definition at line 349 of file control.cpp.

◆ GfctrlJoyInit()

tCtrlJoyInfo* GfctrlJoyInit ( void  )

Initialize the joystick control.

Returns
pointer on a tCtrlJoyInfo structure
0 .. if no joystick present
Note
call GfctrlJoyRelease to free the tCtrlJoyInfo structure
See also
GfctrlJoyRelease
tCtrlJoyInfo

Definition at line 303 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlJoyIsPresent()

int GfctrlJoyIsPresent ( void  )

Check if a joystick is present.

Returns
GFCTRL_JOY_NONE if no joystick
GFCTRL_JOY_PRESENT if a joystick is present

Definition at line 332 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlJoyRelease()

void GfctrlJoyRelease ( tCtrlJoyInfo joyInfo)

Release the tCtrlJoyInfo structure.

Parameters
joyInfojoystick structure
Returns
none

Definition at line 321 of file control.cpp.

◆ GfctrlMouseCenter()

void GfctrlMouseCenter ( void  )

Recentre the mouse on the screen.

Returns
none

Definition at line 476 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlMouseGetCurrent()

int GfctrlMouseGetCurrent ( tCtrlMouseInfo mouseInfo)

Get the mouse current values.

Parameters
mouseInfomouse structure
Returns
0 ... Ok
-1 .. Error
Note
The tCtrlMouseInfo structure is updated with the new values

Definition at line 427 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlMouseInit()

tCtrlMouseInfo* GfctrlMouseInit ( void  )

Initialize the mouse control.

Returns
pointer on a tCtrlMouseInfo structure
0 .. if no mouse present
Note
call GfctrlMouseRelease to free the tCtrlMouseInfo structure
See also
GfctrlMouseRelease

Definition at line 399 of file control.cpp.

◆ GfctrlMouseInitCenter()

void GfctrlMouseInitCenter ( void  )

Get the reference position.

Returns
none

Definition at line 489 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlMouseRelease()

void GfctrlMouseRelease ( tCtrlMouseInfo mouseInfo)

Release the tCtrlMouseInfo structure.

Parameters
mouseInfomouse structure
Returns
none

Definition at line 412 of file control.cpp.

◆ GfuiMouseSetHWPresent()

void GfuiMouseSetHWPresent ( void  )

Force the hardware mouse pointer.

Returns
0 ... Ok
-1 .. Error

Definition at line 241 of file gui.cpp.