This is the primary interface to analog controls like sliders and joysticks associated with a ClientBase. More...
Public Member Functions | |
AnalogNode (ClientBase client, string device_name) | |
clearOutput (int channel) | |
Removes the output to the data graph associated with the indicated channel. | |
double | getControlState (int index) |
Returns the current position of indicated analog control identified by its index number, or 0.0 if the control is unknown. | |
int | getNumControls () |
Returns the number of analog controls known to the AnalogNode. | |
int | getOutput (int channel) |
Returns the analog control index that is output to the data graph on the indicated channel, or -1 if no control is output on that channel. | |
bool | isControlKnown (int index) |
Returns true if the state of the indicated analog control is known, or false if we have never heard anything about this particular control. | |
bool | isOutputFlipped (int channel) |
Returns true if the analog control index that is output to the data graph on the indicated channel is flipped. | |
bool | isValid () |
Returns true if the AnalogNode is valid and connected to a server, false otherwise. | |
setOutput (int channel, int index, bool flip) | |
Causes a particular analog control to be placed in the data graph for the indicated channel. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
This is the primary interface to analog controls like sliders and joysticks associated with a ClientBase.
This creates a node that connects to the named analog device, if it exists, and provides hooks to the user to read the state of any of the sequentially numbered controls associated with that device.
Each control can return a value ranging from -1 to 1, reflecting the current position of the control within its total range of motion.
The user may choose up to two analog controls to place on the data graph as the two channels of an xy datagram, similarly to the way a mouse places its position data. In this way, an AnalogNode may be used in place of a mouse.
AnalogNode | ( | ClientBase | client, |
string | device_name | ||
) |
clearOutput | ( | int | channel | ) |
Removes the output to the data graph associated with the indicated channel.
See set_output().
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from DataNode.
double getControlState | ( | int | index | ) |
Returns the current position of indicated analog control identified by its index number, or 0.0 if the control is unknown.
The normal range of a single control is -1.0 to 1.0.
int getNumControls | ( | ) |
Returns the number of analog controls known to the AnalogNode.
This number may change as more controls are discovered.
Returns the analog control index that is output to the data graph on the indicated channel, or -1 if no control is output on that channel.
See set_output().
bool isControlKnown | ( | int | index | ) |
Returns true if the state of the indicated analog control is known, or false if we have never heard anything about this particular control.
bool isOutputFlipped | ( | int | channel | ) |
Returns true if the analog control index that is output to the data graph on the indicated channel is flipped.
See set_output().
bool isValid | ( | ) |
Returns true if the AnalogNode is valid and connected to a server, false otherwise.
Causes a particular analog control to be placed in the data graph for the indicated channel.
Normally, a mouse uses channels 0 and 1 for the X and Y information, respectively; channels 0, 1, and 2 are available. If flip is true, the analog control value will be reversed before outputting it.