Panda3D
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions
AnalogNode Class Reference

This is the primary interface to analog controls like sliders and joysticks associated with a ClientBase. More...

#include "analogNode.h"

Inheritance diagram for AnalogNode:
DataNode PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase

List of all members.

Classes

class  OutputData

Public Member Functions

 AnalogNode (ClientBase *client, const string &device_name)
void clear_output (int channel)
 Removes the output to the data graph associated with the indicated channel.
virtual TypeHandle force_init_type ()
double get_control_state (int index) const
 Returns the current position of indicated analog control identified by its index number, or 0.0 if the control is unknown.
int get_num_controls () const
 Returns the number of analog controls known to the AnalogNode.
int get_output (int channel) const
 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.
virtual TypeHandle get_type () const
bool is_control_known (int index) const
 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 is_output_flipped (int channel) const
 Returns true if the analog control index that is output to the data graph on the indicated channel is flipped.
bool is_valid () const
 Returns true if the AnalogNode is valid and connected to a server, false otherwise.
void set_output (int channel, int index, bool flip)
 Causes a particular analog control to be placed in the data graph for the indicated channel.
virtual void write (ostream &out, int indent_level=0) const

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Member Functions

virtual void do_transmit_data (DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output)
 The virtual implementation of transmit_data().

Detailed Description

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.

Definition at line 45 of file analogNode.h.


Member Function Documentation

void AnalogNode::clear_output ( int  channel) [inline]

Removes the output to the data graph associated with the indicated channel.

See set_output().

Definition at line 108 of file analogNode.I.

void AnalogNode::do_transmit_data ( DataGraphTraverser trav,
const DataNodeTransmit input,
DataNodeTransmit output 
) [protected, virtual]

The virtual implementation of transmit_data().

This function receives an array of input parameters and should generate an array of output parameters. The input parameters may be accessed with the index numbers returned by the define_input() calls that were made earlier (presumably in the constructor); likewise, the output parameters should be set with the index numbers returned by the define_output() calls.

Reimplemented from DataNode.

Definition at line 97 of file analogNode.cxx.

References is_valid(), and DataNodeTransmit::set_data().

double AnalogNode::get_control_state ( int  index) const [inline]

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.

Definition at line 62 of file analogNode.I.

int AnalogNode::get_num_controls ( ) const [inline]

Returns the number of analog controls known to the AnalogNode.

This number may change as more controls are discovered.

Definition at line 46 of file analogNode.I.

int AnalogNode::get_output ( int  channel) const [inline]

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

Definition at line 121 of file analogNode.I.

bool AnalogNode::is_control_known ( int  index) const [inline]

Returns true if the state of the indicated analog control is known, or false if we have never heard anything about this particular control.

Definition at line 77 of file analogNode.I.

bool AnalogNode::is_output_flipped ( int  channel) const [inline]

Returns true if the analog control index that is output to the data graph on the indicated channel is flipped.

See set_output().

Definition at line 134 of file analogNode.I.

bool AnalogNode::is_valid ( ) const [inline]

Returns true if the AnalogNode is valid and connected to a server, false otherwise.

Definition at line 34 of file analogNode.I.

Referenced by do_transmit_data().

void AnalogNode::set_output ( int  channel,
int  index,
bool  flip 
) [inline]

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.

Definition at line 95 of file analogNode.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations