Thrive
keyboard.h
1 #pragma once
2 
3 #include <list>
4 #include <memory>
5 #include <OISKeyboard.h>
6 
7 namespace luabind {
8 class scope;
9 }
10 
11 namespace OIS {
12 class InputManager;
13 }
14 
15 namespace CEGUI {
16  class InputAggregator;
17 }
18 
19 namespace thrive {
20 
24 class Keyboard {
25 
26 public:
27 
31  struct KeyEvent {
32 
36  const OIS::KeyCode key;
37 
41  const bool pressed;
42 
46  const bool alt;
47 
51  const bool ctrl;
52 
56  const bool shift;
57 
58  };
59 
74  static luabind::scope
75  luaBindings();
76 
80  Keyboard();
81 
85  ~Keyboard();
86 
94  const std::list<KeyEvent>&
95  eventQueue() const;
96 
103  void
104  init(
105  OIS::InputManager* inputManager,
106  CEGUI::InputAggregator* aggregator
107  );
108 
119  bool
120  isKeyDown(
121  OIS::KeyCode key
122  ) const;
123 
127  void
128  shutdown();
129 
133  void
134  update();
135 
148  bool
150  OIS::KeyCode key
151  ) const;
152 
165  bool
167  OIS::KeyCode key
168  ) const;
169 
170 private:
171 
172  struct Implementation;
173  std::unique_ptr<Implementation> m_impl;
174 };
175 
176 }
void init(OIS::InputManager *inputManager, CEGUI::InputAggregator *aggregator)
Initializes the keyboard.
Definition: keyboard.cpp:289
Definition: engine.h:30
Definition: script_wrappers.h:5
void shutdown()
Shuts down the keyboard.
Definition: keyboard.cpp:313
~Keyboard()
Destructor.
Definition: keyboard.cpp:279
const bool shift
true if the Shift modifier was pressed during the event
Definition: keyboard.h:56
Handles keyboard events.
Definition: keyboard.h:24
const bool ctrl
true if the Ctrl modifier was pressed during the event
Definition: keyboard.h:51
Definition: bullet_to_ogre_system.h:5
Definition: bullet_ogre_conversion.h:6
bool isKeyDown(OIS::KeyCode key) const
Checks whether a key is pressed down.
Definition: keyboard.cpp:305
bool wasKeyPressed(OIS::KeyCode key) const
Checks whether a key was pressed down since the last frame.
Definition: keyboard.cpp:330
Represents a single key press or release.
Definition: keyboard.h:31
bool wasKeyReleased(OIS::KeyCode key) const
Checks whether a key was released since the last frame.
Definition: keyboard.cpp:340
static luabind::scope luaBindings()
Lua bindings.
Definition: keyboard.cpp:108
const bool pressed
true if the key was pressed, false if it was released
Definition: keyboard.h:41
const bool alt
true if the Alt modifier was pressed during the event
Definition: keyboard.h:46
Keyboard()
Constructor.
Definition: keyboard.cpp:273
const std::list< KeyEvent > & eventQueue() const
A list of key events in the current frame.
Definition: keyboard.cpp:283
void update()
Updates the queue with new events.
Definition: keyboard.cpp:321
const OIS::KeyCode key
The key that was pressed.
Definition: keyboard.h:36