2013-08-13 20:04:25 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Keyboard.h *
|
|
|
|
* *
|
2013-10-03 14:40:24 +02:00
|
|
|
* XFX::Input::Keyboard class definition file. *
|
|
|
|
* Copyright (c) XFX Team. All Rights Reserved. *
|
2013-08-13 20:04:25 +02:00
|
|
|
*****************************************************************************/
|
2013-05-05 18:18:41 +02:00
|
|
|
#ifndef _XFX_INPUT_KEYBOARD_
|
|
|
|
#define _XFX_INPUT_KEYBOARD_
|
|
|
|
|
|
|
|
#include "Enums.h"
|
|
|
|
|
|
|
|
namespace XFX
|
|
|
|
{
|
|
|
|
namespace Input
|
|
|
|
{
|
2013-08-13 20:04:25 +02:00
|
|
|
/**
|
|
|
|
* Represents a state of keystrokes recorded by a keyboard input device.
|
|
|
|
*/
|
2013-05-05 18:18:41 +02:00
|
|
|
struct KeyboardState
|
|
|
|
{
|
|
|
|
KeyboardState();
|
|
|
|
KeyboardState(Keys_t keys[]);
|
|
|
|
KeyboardState(const KeyboardState &obj);
|
|
|
|
|
|
|
|
Keys_t* GetPressedKeys();
|
|
|
|
bool IsKeyDown(Keys_t key);
|
|
|
|
bool IsKeyUp(Keys_t key);
|
|
|
|
|
2013-07-11 20:00:07 +02:00
|
|
|
/**
|
|
|
|
* Returns the state of a particular key.
|
|
|
|
*
|
|
|
|
* @param key
|
|
|
|
* Enumerated value representing the key to query.
|
|
|
|
*/
|
|
|
|
const KeyState_t operator[](const Keys_t key) const;
|
|
|
|
|
2013-05-05 18:18:41 +02:00
|
|
|
private:
|
|
|
|
Keys_t* pressedKeys;
|
|
|
|
};
|
|
|
|
|
2013-08-13 20:04:25 +02:00
|
|
|
/**
|
|
|
|
* Allows retrieval of keystrokes from a keyboard input device.
|
|
|
|
*/
|
2013-05-05 18:18:41 +02:00
|
|
|
class Keyboard
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
Keyboard(); //Private constructor to prevent instantiation.
|
|
|
|
|
|
|
|
public:
|
|
|
|
static KeyboardState GetState();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //_XFX_INPUT_KEYBOARD_
|