Panda3D
|
Reads the mouse and/or keyboard data sent from a GraphicsWindow, and transmits it down the data graph. More...
#include "mouseAndKeyboard.h"
Public Member Functions | |
MouseAndKeyboard (GraphicsWindow *window, int device, const string &name) | |
virtual TypeHandle | force_init_type () |
int | get_source_device () const |
Returns the associated source device. | |
virtual TypeHandle | get_type () const |
PT (GraphicsWindow) get_source_window() const | |
void | set_source (GraphicsWindow *window, int device) |
Redirects the class to get the data from the mouse and keyboard associated with a different window and/or device number. | |
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(). |
Reads the mouse and/or keyboard data sent from a GraphicsWindow, and transmits it down the data graph.
The mouse and keyboard devices are bundled together into one device here, because they interrelate so much. A mouse might be constrained by the holding down of the shift key, for instance, or the clicking of the mouse button might be handled in much the same way as a keyboard key.
Mouse data is sent down the data graph as an x,y position as well as the set of buttons currently being held down; keyboard data is sent down as a set of keypress events in an EventDataTransition. To throw these events to the system, you must attach an EventThrower to the MouseAndKeyboard object; otherwise, the events will be discarded.
Definition at line 47 of file mouseAndKeyboard.h.
void MouseAndKeyboard::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 94 of file mouseAndKeyboard.cxx.
References WindowProperties::get_x_size(), WindowProperties::get_y_size(), WindowProperties::has_size(), and DataNodeTransmit::set_data().
int MouseAndKeyboard::get_source_device | ( | ) | const |
Returns the associated source device.
Definition at line 76 of file mouseAndKeyboard.cxx.
void MouseAndKeyboard::set_source | ( | GraphicsWindow * | window, |
int | device | ||
) |
Redirects the class to get the data from the mouse and keyboard associated with a different window and/or device number.
Definition at line 55 of file mouseAndKeyboard.cxx.