TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
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.
const char * GfctrlGetNameByRef (GfCtrlType type, int index)
 Get a control name by its reference.
tCtrlJoyInfo * GfctrlJoyInit (void)
 Initialize the joystick control.
void GfctrlJoyRelease (tCtrlJoyInfo *joyInfo)
 Release the tCtrlJoyInfo structure.
int GfctrlJoyIsPresent (void)
 Check if a joystick is present.
int GfctrlJoyGetCurrent (tCtrlJoyInfo *joyInfo)
 Get the joystick current values.
tCtrlMouseInfo * GfctrlMouseInit (void)
 Initialize the mouse control.
void GfctrlMouseRelease (tCtrlMouseInfo *mouseInfo)
 Release the tCtrlMouseInfo structure.
int GfctrlMouseGetCurrent (tCtrlMouseInfo *mouseInfo)
 Get the mouse current values.
void GfctrlMouseCenter (void)
 Recentre the mouse on the screen.
void GfctrlMouseInitCenter (void)
 Get the reference position.
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 GfuiMouseSetHWPresent (void)
 Force the hardware mouse pointer.

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 498 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 348 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 331 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlJoyRelease()

void GfctrlJoyRelease ( tCtrlJoyInfo * joyInfo)

Release the tCtrlJoyInfo structure.

Parameters
joyInfojoystick structure

Definition at line 320 of file control.cpp.

◆ GfctrlMouseCenter()

void GfctrlMouseCenter ( void )

Recentre the mouse on the screen.

Definition at line 473 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 425 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 398 of file control.cpp.

◆ GfctrlMouseInitCenter()

void GfctrlMouseInitCenter ( void )

Get the reference position.

Definition at line 485 of file control.cpp.

Here is the call graph for this function:

◆ GfctrlMouseRelease()

void GfctrlMouseRelease ( tCtrlMouseInfo * mouseInfo)

Release the tCtrlMouseInfo structure.

Parameters
mouseInfomouse structure

Definition at line 410 of file control.cpp.

◆ GfuiMouseSetHWPresent()

void GfuiMouseSetHWPresent ( void )

Force the hardware mouse pointer.

Definition at line 278 of file gui.cpp.