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));
get_input_device
Returns the nth input device associated with the window.
The fundamental type of node for the data graph.
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...
An optional parameter associated with an event.
Records a set of pointer events that happened recently.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A handy class object for storing simple values (like integers or strings) passed along with an Event ...
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
void set_data(int index, const EventParameter &data)
Sets the data for the indicated parameter.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Holds the data that might be generated by a 2-d pointer input device, such as the mouse in the Graphi...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_y_size() const
Returns size in pixels in the y dimension of the useful part of the window, not including decorations...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
TypeHandle is the identifier used to differentiate C++ class types.
has_size
Returns true if the window size has been specified, false otherwise.
Encapsulates the data generated from (or sent into) any particular DataNode.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...