Thrive
Classes | Public Member Functions | Static Public Member Functions | List of all members
thrive::Keyboard Class Reference

Handles keyboard events. More...

#include <keyboard.h>

Classes

struct  Implementation
 
struct  KeyEvent
 Represents a single key press or release. More...
 

Public Member Functions

 Keyboard ()
 Constructor.
 
 ~Keyboard ()
 Destructor.
 
const std::list< KeyEvent > & eventQueue () const
 A list of key events in the current frame. More...
 
void init (OIS::InputManager *inputManager, CEGUI::InputAggregator *aggregator)
 Initializes the keyboard. More...
 
bool isKeyDown (OIS::KeyCode key) const
 Checks whether a key is pressed down. More...
 
void shutdown ()
 Shuts down the keyboard.
 
void update ()
 Updates the queue with new events.
 
bool wasKeyPressed (OIS::KeyCode key) const
 Checks whether a key was pressed down since the last frame. More...
 
bool wasKeyReleased (OIS::KeyCode key) const
 Checks whether a key was released since the last frame. More...
 

Static Public Member Functions

static luabind::scope luaBindings ()
 Lua bindings. More...
 

Detailed Description

Handles keyboard events.

Member Function Documentation

const std::list< Keyboard::KeyEvent > & Keyboard::eventQueue ( ) const

A list of key events in the current frame.

The list is cleared and newly populated for each call to update().

Returns
void Keyboard::init ( OIS::InputManager *  inputManager,
CEGUI::InputAggregator *  aggregator 
)

Initializes the keyboard.

Parameters
inputManagerThe input manager to use
bool Keyboard::isKeyDown ( OIS::KeyCode  key) const

Checks whether a key is pressed down.

Parameters
keyThe key to check for
Returns
true if the key is pressed down during this frame, false otherwise
luabind::scope Keyboard::luaBindings ( )
static
bool Keyboard::wasKeyPressed ( OIS::KeyCode  key) const

Checks whether a key was pressed down since the last frame.

This function compares the state of the previous and this frame. If key was not down in the last frame and down in this frame, it returns true.

Parameters
keyThe key to check for
Returns
true if key was pressed down
bool Keyboard::wasKeyReleased ( OIS::KeyCode  key) const

Checks whether a key was released since the last frame.

This function compares the state of the previous and this frame. If key was down in the last frame and not down in this frame, it returns true.

Parameters
keyThe key to check for
Returns
true if key was released

The documentation for this class was generated from the following files: