![]() |
Xors3d Engine
|
Functions | |
int | xCountJoys () |
Returns the number of attached joysticks. | |
void | xFlushJoy () |
Clears information about joystick keys hits. | |
int | xGetJoy (int portID=0) |
Returns pressed joystick button. | |
int | xJoyDown (int key, int portID=0) |
Detects if a joystick button is being held down. | |
float | xJoyHat (int portID=0) |
Returns the state of a joystick 'hat' or 'pov' (point-of-view) control. | |
int | xJoyHit (int key, int portID=0) |
Returns the number of times a specified button has been hit. | |
float | xJoyPitch (int portID=0) |
Returns the pitch value of a joystick. | |
float | xJoyRoll (int portID=0) |
Returns the roll value of a joystick. | |
int | xJoyType (int portID=0) |
Returns joystick type. | |
float | xJoyU (int portID=0) |
Returns the value of the u-axis of the joystick. | |
int | xJoyUDir (int portID=0) |
Returns the direction of the u-axis of the joystick. | |
float | xJoyV (int portID=0) |
Returns the value of the v-axis of the joystick. | |
int | xJoyVDir (int portID=0) |
Returns the direction of the v-axis of the joystick. | |
float | xJoyX (int portID=0) |
Returns the value of the x-axis of the joystick. | |
int | xJoyXDir (int portID=0) |
Returns the direction of the x-axis of the joystick. | |
float | xJoyY (int portID=0) |
Returns the value of the y-axis of the joystick. | |
float | xJoyYaw (int portID=0) |
Returns the yaw value of a joystick. | |
int | xJoyYDir (int portID=0) |
Returns the direction of the y-axis of the joystick. | |
float | xJoyZ (int portID=0) |
Returns the value of the z-axis of the joystick. | |
int | xJoyZDir (int portID=0) |
Returns the direction of the z-axis of the joystick. | |
int | xWaitJoy (int portID=0) |
Stops program execution unless any joystick key is not pressed. |
int xJoyType | ( | int | portID = 0 | ) |
Returns joystick type.
This command returns the type of joystick which is currently connected to the computer. See 'Joystick types' for return values.
portID | Number of joystick port to be checked |
int xJoyDown | ( | int | key, |
int | portID = 0 |
||
) |
Detects if a joystick button is being held down.
This command (and its counterparts xKeyDown and xMouseDown) is used to detect if a joystick button is being held down. You must check for each joystick button independantly with its corresponding number.
key | Number of joystick button to check |
portID | Number of joystick port to check |
int xJoyHit | ( | int | key, |
int | portID = 0 |
||
) |
Returns the number of times a specified button has been hit.
This command returns the number of times a specified joystick button has been hit since the last time you called the xJoyHit() command
key | Number of joystick button to check |
portID | Number of joystick port to check |
int xGetJoy | ( | int | portID = 0 | ) |
Returns pressed joystick button.
Unlike the other similar commands (xJoyDown() and xJoyHit()), this command doesn't need to know which button you are trying to test for. It looks for any joystick button, then returns the number the user pressed. Since you are polling all the buttons instead of just a specific one, this may be a tad less efficient than using xJoyDown() or xJoyHit().
portID | Number of joystick port to check |
void xFlushJoy | ( | ) |
Clears information about joystick keys hits.
There are many times when you aren't interested in the dozens of possible joystick button pressed the player might have made before you are checking for one in particular. Or perhaps you want to pause the game and wait for any joystick button to be hit, but you don't want a 'queued' button press bypassing this. Use this command before you specifically want to poll a joystick button hit from the user.
int xWaitJoy | ( | int | portID = 0 | ) |
Stops program execution unless any joystick key is not pressed.
This command makes your program halt until a joystick button is pressed on the joystick. Used alone, it simply halts and waits for a button press. It return pressed button's code value.
portID | Number of joystick port to check |
float xJoyX | ( | int | portID = 0 | ) |
Returns the value of the x-axis of the joystick.
This command returns the value of the x-axis of the joystick. The range is [-1; 1] (full left to full right). The value returned is a floating point number.
portID | Number of joystick port to check |
float xJoyY | ( | int | portID = 0 | ) |
Returns the value of the y-axis of the joystick.
This command returns the value of the y-axis of the joystick. The range is [-1; 1] (full left to full right). The value returned is a floating point number.
portID | Number of joystick port to check |
float xJoyZ | ( | int | portID = 0 | ) |
Returns the value of the z-axis of the joystick.
This command returns the value of the z-axis of the joystick. The range is [-1; 1] (full left to full right). The value returned is a floating point number.
portID | Number of joystick port to check |
float xJoyU | ( | int | portID = 0 | ) |
Returns the value of the u-axis of the joystick.
Returns a float value in range [-1; 1] that represents the U value of a joystick's output. The U value of a joystick usually corresponds to a joystick's 'slider' or 'throttle' feature, although this may vary depending on the joystick, and will not be available with all joysticks. The value returned is a floating point number.
portID | Number of joystick port to check |
float xJoyV | ( | int | portID = 0 | ) |
Returns the value of the v-axis of the joystick.
Returns a float value in range [-1; 1] that represents the V value of a joystick's output. The value returned is a floating point number.
portID | Number of joystick port to check |
float xJoyPitch | ( | int | portID = 0 | ) |
Returns the pitch value of a joystick.
portID | Number of joystick port to check |
float xJoyYaw | ( | int | portID = 0 | ) |
Returns the yaw value of a joystick.
portID | Number of joystick port to check |
float xJoyRoll | ( | int | portID = 0 | ) |
Returns the roll value of a joystick.
The roll value of a joystick usually corresponds to a joystick's 'twistable stick' or 'rudder' feature, although this may vary depending on the joystick, and will not be available with all joysticks.
portID | Number of joystick port to check |
float xJoyHat | ( | int | portID = 0 | ) |
Returns the state of a joystick 'hat' or 'pov' (point-of-view) control.
If the returned value is -1, the hat is currently centred.
portID | Number of joystick port to check |
int xJoyXDir | ( | int | portID = 0 | ) |
Returns the direction of the x-axis of the joystick.
This command returns the direction of the x-axis of the joystick being pressed. The value is -1 (left) or 1 (right). The value returned is an integer number. Perfect for digital joysticks.
portID | Number of joystick port to check |
int xJoyYDir | ( | int | portID = 0 | ) |
Returns the direction of the y-axis of the joystick.
This command returns the direction of the y-axis of the joystick being pressed. The value is -1 (left) or 1 (right). The value returned is an integer number. Perfect for digital joysticks.
portID | Number of joystick port to check |
int xJoyZDir | ( | int | portID = 0 | ) |
Returns the direction of the z-axis of the joystick.
This command returns the direction of the z-axis of the joystick being pressed. The value is -1 (left) or 1 (right). The value returned is an integer number. Perfect for digital joysticks.
portID | Number of joystick port to check |
int xJoyUDir | ( | int | portID = 0 | ) |
Returns the direction of the u-axis of the joystick.
This command returns the direction of the u-axis of the joystick being pressed. The value is -1 (left) or 1 (right). The value returned is an integer number. Perfect for digital joysticks.
portID | Number of joystick port to check |
int xJoyVDir | ( | int | portID = 0 | ) |
Returns the direction of the v-axis of the joystick.
This command returns the direction of the v-axis of the joystick being pressed. The value is -1 (left) or 1 (right). The value returned is an integer number. Perfect for digital joysticks.
portID | Number of joystick port to check |
int xCountJoys | ( | ) |
Returns the number of attached joysticks.
This function doesn't update the number of joysticks in runtime. It means that after detaching of the joystick, this function continues to return the same number. Use Input::ListenControllerConnection to handle this.