15 #include "mouseAndKeyboard.h"
16 #include "mouseData.h"
17 #include "buttonHandle.h"
18 #include "buttonEvent.h"
19 #include "dataNodeTransmit.h"
20 #include "graphicsWindow.h"
30 MouseAndKeyboard(
GraphicsWindow *window,
int device,
const string &name) :
35 _pixel_xy_output = define_output(
"pixel_xy", EventStoreVec2::get_class_type());
36 _pixel_size_output = define_output(
"pixel_size", EventStoreVec2::get_class_type());
37 _xy_output = define_output(
"xy", EventStoreVec2::get_class_type());
38 _button_events_output = define_output(
"button_events", ButtonEventList::get_class_type());
39 _pointer_events_output = define_output(
"pointer_events", PointerEventList::get_class_type());
66 get_source_window()
const {
75 int MouseAndKeyboard::
76 get_source_device()
const {
93 void MouseAndKeyboard::
96 if (_window->has_button_event(_device)) {
98 _button_events->clear();
99 while (_window->has_button_event(_device)) {
100 ButtonEvent be = _window->get_button_event(_device);
101 _button_events->add_event(be);
105 if (_window->has_pointer_event(_device)) {
112 if (properties.has_size()) {
114 int h = properties.get_y_size();
116 _pixel_size->set_value(
LPoint2(w, h));
119 if (_window->has_pointer(_device)) {
120 const MouseData &mdata = _window->get_pointer(_device);
122 if (mdata._in_window) {
124 _pixel_xy->set_value(
LPoint2(mdata._xpos, mdata._ypos));
128 PN_stdfloat xf = (PN_stdfloat)(2 * mdata._xpos) / (PN_stdfloat)w - 1.0f;
129 PN_stdfloat yf = 1.0f - (PN_stdfloat)(2 * mdata._ypos) / (PN_stdfloat)h;
131 _xy->set_value(
LPoint2(xf, yf));
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.
Reads the mouse and/or keyboard data sent from a GraphicsWindow, and transmits it down the data graph...
Records a set of pointer events that happened recently.
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.
Holds the data that might be generated by a 2-d pointer input device, such as the mouse in the Graphi...
int get_x_size() const
Returns size in pixels in the x dimension of the useful part of the window, not including decorations...
This is a two-component point in space.
TypeHandle is the identifier used to differentiate C++ class types.
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...