Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions

VirtualMouse Class Reference

Poses as a MouseAndKeyboard object in the datagraph, but accepts input from user calls, rather than reading the actual mouse and keyboard from an input device. More...

#include "virtualMouse.h"

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

List of all members.

Public Member Functions

 VirtualMouse (const string &name)
virtual TypeHandle force_init_type ()
virtual TypeHandle get_type () const
void press_button (ButtonHandle button)
 Simulates a mouse or keyboard button being depressed.
void release_button (ButtonHandle button)
 Simulates the button being released.
void set_mouse_on (bool flag)
 Sets whether the mouse should appear to be within the window or not.
void set_mouse_pos (int x, int y)
 Sets the current mouse pixel location, where (0,0) is the upper left, and (width-1, height-1) is the lower right pixel of the virtual window.
void set_window_size (int width, int height)
 Sets the size of the "window" in which the mouse rolls.

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

Poses as a MouseAndKeyboard object in the datagraph, but accepts input from user calls, rather than reading the actual mouse and keyboard from an input device.

The user can write high-level code to put the mouse wherever he/she wants, and to insert keypresses on demand.

Definition at line 36 of file virtualMouse.h.


Member Function Documentation

void VirtualMouse::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 124 of file virtualMouse.cxx.

References DataNodeTransmit::set_data().

void VirtualMouse::press_button ( ButtonHandle  button)

Simulates a mouse or keyboard button being depressed.

This should be followed up by a call to release_button() sometime later (possibly immediately).

Definition at line 95 of file virtualMouse.cxx.

void VirtualMouse::release_button ( ButtonHandle  button)

Simulates the button being released.

This should follow a previous call to press_button().

Definition at line 106 of file virtualMouse.cxx.

void VirtualMouse::set_mouse_on ( bool  flag)

Sets whether the mouse should appear to be within the window or not.

If this is true, the mouse is within the window; if false, the mouse is not within the window (and set_mouse_pos() means nothing).

Definition at line 82 of file virtualMouse.cxx.

void VirtualMouse::set_mouse_pos ( int  x,
int  y 
)

Sets the current mouse pixel location, where (0,0) is the upper left, and (width-1, height-1) is the lower right pixel of the virtual window.

Definition at line 55 of file virtualMouse.cxx.

void VirtualMouse::set_window_size ( int  width,
int  height 
)

Sets the size of the "window" in which the mouse rolls.

This changes the meaning of the values passed to set_mouse_pos().

Definition at line 68 of file virtualMouse.cxx.


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