Panda3D
 All Classes Functions Variables Enumerations
rocketInputHandler.h
1 // Filename: rocketInputHandler.h
2 // Created by: rdb (20Dec11)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef ROCKETINPUTHANDLER_H
16 #define ROCKETINPUTHANDLER_H
17 
18 #include "config_rocket.h"
19 #include "dataNode.h"
20 #include "buttonHandle.h"
21 
22 namespace Rocket {
23  namespace Core {
24  class Context;
25  }
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : RocketInputHandler
30 // Description : DataNode that listens for keyboard and mouse
31 // events and passes them to libRocket.
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_ROCKET RocketInputHandler : public DataNode {
34 PUBLISHED:
35  RocketInputHandler(const string &name = string());
36  virtual ~RocketInputHandler();
37 
38  static int get_rocket_key(const ButtonHandle handle);
39 
40 public:
41  void update_context(Rocket::Core::Context *context, int xoffs, int yoffs);
42 
43 protected:
44  // Inherited from DataNode
45  virtual void do_transmit_data(DataGraphTraverser *trav,
46  const DataNodeTransmit &input,
47  DataNodeTransmit &output);
48 
49 private:
50  Mutex _lock;
51 
52  // inputs
53  int _pixel_xy_input;
54  int _button_events_input;
55 
56  LVecBase2 _mouse_xy;
57  bool _mouse_xy_changed;
58  int _modifiers;
59  int _wheel_delta;
61  ButtonActivityMap _mouse_buttons;
62  ButtonActivityMap _keys;
63  pvector<int> _repeated_keys;
64  pvector<short> _text_input;
65 
66 public:
67  static TypeHandle get_class_type() {
68  return _type_handle;
69  }
70  static void init_type() {
71  DataNode::init_type();
72  register_type(_type_handle, "RocketInputHandler",
73  DataNode::get_class_type());
74  }
75  virtual TypeHandle get_type() const {
76  return get_class_type();
77  }
78  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
79 
80 private:
81  static TypeHandle _type_handle;
82 };
83 
84 #endif
The fundamental type of node for the data graph.
Definition: dataNode.h:64
A standard mutex, or mutual exclusion lock.
Definition: pmutex.h:44
A ButtonHandle represents a single button from any device, including keyboard buttons and mouse butto...
Definition: buttonHandle.h:28
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:105
DataNode that listens for keyboard and mouse events and passes them to libRocket. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
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...