AgateLib.InputLib.Joystick Class Reference

Class which encapsulates a single joystick. More...

List of all members.

Public Member Functions

double GetAxisValue (int axisIndex)
 Gets the current value for the given axis. Axis 0 is always the x-axis, axis 1 is always the y-axis on controlers which have this capability.
bool GetButtonState (int buttonIndex)
 Gets whether or not the specified button is pushed.
void Recalibrate ()
 Recalibrates this joystick.
void Poll ()
 Polls the joystick for data.

Properties

string Name [get]
 Returns the name of the joystick.
int AxisCount [get]
 Gets how many axes are available on this joystick.
int ButtonCount [get]
 Returns the number of buttons this joystick has.
double AxisThreshold [get, set]
 Values smaller than this value for axes will be truncated and returned as zero.
double Xaxis [get]
 Returns the value of the joystick x-axis. Ranges are: -1 all the way to the left 0 centered 1 all the way to the right.
double Yaxis [get]
 Returns the value of the joystick y-axis. Ranges are: -1 all the way to the top 0 centered 1 all the way to the bottom.
bool PluggedIn [get]
 Returns whether or not this joystick is plugged in.


Detailed Description

Class which encapsulates a single joystick.


Member Function Documentation

double AgateLib.InputLib.Joystick.GetAxisValue ( int  axisIndex  ) 

Gets the current value for the given axis. Axis 0 is always the x-axis, axis 1 is always the y-axis on controlers which have this capability.

Parameters:
axisIndex 
Returns:

bool AgateLib.InputLib.Joystick.GetButtonState ( int  buttonIndex  ) 

Gets whether or not the specified button is pushed.

Parameters:
buttonIndex 
Returns:

void AgateLib.InputLib.Joystick.Poll (  ) 

Polls the joystick for data.

void AgateLib.InputLib.Joystick.Recalibrate (  ) 

Recalibrates this joystick.

Behavior is driver-dependent, however this usually means taking the current position as the "zeroed" position for the joystick.


Property Documentation

int AgateLib.InputLib.Joystick.AxisCount [get]

Gets how many axes are available on this joystick.

double AgateLib.InputLib.Joystick.AxisThreshold [get, set]

Values smaller than this value for axes will be truncated and returned as zero.

int AgateLib.InputLib.Joystick.ButtonCount [get]

Returns the number of buttons this joystick has.

string AgateLib.InputLib.Joystick.Name [get]

Returns the name of the joystick.

bool AgateLib.InputLib.Joystick.PluggedIn [get]

Returns whether or not this joystick is plugged in.

If a joystick is removed, you must throw away the reference to this object and get a new one.

double AgateLib.InputLib.Joystick.Xaxis [get]

Returns the value of the joystick x-axis. Ranges are: -1 all the way to the left 0 centered 1 all the way to the right.

Values outside this range may be returned. Never do tests which expect exact return values. Even digital gamepads will sometimes return values close to 1 when pushed down, instead of exactly 1.

double AgateLib.InputLib.Joystick.Yaxis [get]

Returns the value of the joystick y-axis. Ranges are: -1 all the way to the top 0 centered 1 all the way to the bottom.

Values outside this range may be returned. Never do tests which expect exact return values. Even digital gamepads will sometimes return values close to 1 when pushed down, instead of exactly 1.


The documentation for this class was generated from the following file:
AgateLib
Awesome Game and Tool Engine Library
SourceForge.net Logo