23 VirtualMouse(
const std::string &name) :
26 _pixel_xy_output = define_output(
"pixel_xy", EventStoreVec2::get_class_type());
27 _pixel_size_output = define_output(
"pixel_size", EventStoreVec2::get_class_type());
28 _xy_output = define_output(
"xy", EventStoreVec2::get_class_type());
29 _button_events_output = define_output(
"button_events", ButtonEventList::get_class_type());
81 _next_button_events->add_event(
ButtonEvent(button, ButtonEvent::T_down));
90 _next_button_events->add_event(
ButtonEvent(button, ButtonEvent::T_up));
106 _button_events = _next_button_events;
107 _next_button_events = events;
108 _next_button_events->clear();
111 _pixel_size->set_value(LPoint2(_win_width, _win_height));
116 _pixel_xy->set_value(LPoint2(_mouse_x, _mouse_y));
120 PN_stdfloat xf = (2.0f * (PN_stdfloat)_mouse_x) / (PN_stdfloat)_win_width - 1.0f;
121 PN_stdfloat yf = 1.0f - (2.0f * (PN_stdfloat)_mouse_y) / (PN_stdfloat)_win_height;
122 _xy->set_value(LPoint2(xf, yf));
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
Encapsulates the data generated from (or sent into) any particular DataNode.
void set_data(int index, const EventParameter &data)
Sets the data for the indicated parameter.
The fundamental type of node for the data graph.
An optional parameter associated with an event.
A handy class object for storing simple values (like integers or strings) passed along with an Event ...
TypeHandle is the identifier used to differentiate C++ class types.
void set_window_size(int width, int height)
Sets the size of the "window" in which the mouse rolls.
void release_button(ButtonHandle button)
Simulates the button being released.
void set_mouse_pos(int x, int y)
Sets the current mouse pixel location, where (0,0) is the upper left, and (width-1,...
void set_mouse_on(bool flag)
Sets whether the mouse should appear to be within the window or not.
void press_button(ButtonHandle button)
Simulates a mouse or keyboard button being depressed.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.