27 MouseAndKeyboard(
GraphicsWindow *window,
int device,
const std::string &name) :
30 _device(window->get_input_device(device))
32 _pixel_xy_output = define_output(
"pixel_xy", EventStoreVec2::get_class_type());
33 _pixel_size_output = define_output(
"pixel_size", EventStoreVec2::get_class_type());
34 _xy_output = define_output(
"xy", EventStoreVec2::get_class_type());
35 _button_events_output = define_output(
"button_events", ButtonEventList::get_class_type());
36 _pointer_events_output = define_output(
"pointer_events", PointerEventList::get_class_type());
42 _device->enable_pointer_events();
65 void MouseAndKeyboard::
86 _pixel_size->set_value(LPoint2(w, h));
92 if (mdata._in_window) {
94 _pixel_xy->set_value(LPoint2(mdata._xpos, mdata._ypos));
98 PN_stdfloat xf = (PN_stdfloat)(2 * mdata._xpos) / (PN_stdfloat)w - 1.0f;
99 PN_stdfloat yf = 1.0f - (PN_stdfloat)(2 * mdata._ypos) / (PN_stdfloat)h;
101 _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 window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
get_input_device
Returns the nth input device associated with the window.
void set_source(GraphicsWindow *window, int device)
Redirects the class to get the data from the mouse and keyboard associated with a different window an...
A handy class object for storing simple values (like integers or strings) passed along with an Event ...
Holds the data that might be generated by a 2-d pointer input device, such as the mouse in the Graphi...
Records a set of pointer events that happened recently.
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
int get_y_size() const
Returns size in pixels in the y dimension of the useful part of the window, not including decorations...
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
has_size
Returns true if the window size has been specified, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.