2014-02-14 15:50:00 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by [Dennis Andersen] [2013]
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef INPUT_KEYBOARD_H
|
|
|
|
#define INPUT_KEYBOARD_H
|
|
|
|
|
|
|
|
#include "..\Keyboard.h"
|
2014-02-21 11:43:05 +01:00
|
|
|
#define NOMINMAX
|
2014-02-14 15:50:00 +01:00
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
namespace Input
|
|
|
|
{
|
|
|
|
class Win32Keyboard :public Keyboard
|
|
|
|
{
|
|
|
|
public:
|
2014-02-24 16:01:06 +01:00
|
|
|
Win32Keyboard(HWND target);
|
2014-02-14 15:50:00 +01:00
|
|
|
~Win32Keyboard();
|
|
|
|
|
|
|
|
bool IsKeyUp (Enum::SAKI key) override;
|
|
|
|
bool IsKeyDown (Enum::SAKI key) override;
|
2014-02-21 11:43:05 +01:00
|
|
|
wchar_t* GetAsText(Enum::SAKI key) override;
|
2014-02-14 15:50:00 +01:00
|
|
|
|
2014-02-24 16:01:06 +01:00
|
|
|
public: /* From InputObject */
|
|
|
|
void Activate () override;
|
|
|
|
void Deactivate () override;
|
|
|
|
inline bool IsActive() override { return this->isActive; }
|
|
|
|
|
2014-02-21 11:43:05 +01:00
|
|
|
void ProccessKeyboardData (RAWKEYBOARD keyboard);
|
2014-02-24 16:01:06 +01:00
|
|
|
bool Create( );
|
2014-02-14 15:50:00 +01:00
|
|
|
|
|
|
|
private:
|
2014-02-21 11:43:05 +01:00
|
|
|
void MapKey(RAWKEYBOARD& rawKB, Enum::SAKI& out_key, bool& isE0);
|
|
|
|
|
2014-02-14 15:50:00 +01:00
|
|
|
struct Keys
|
|
|
|
{
|
|
|
|
bool isE0;
|
|
|
|
bool isDown;
|
|
|
|
unsigned int makecode;
|
|
|
|
};
|
2014-02-24 16:01:06 +01:00
|
|
|
RAWINPUTDEVICE device;
|
2014-02-14 15:50:00 +01:00
|
|
|
static const int MAXKEYS = 256;
|
|
|
|
Keys keys[MAXKEYS];
|
2014-02-24 16:01:06 +01:00
|
|
|
bool isActive;
|
2014-02-14 15:50:00 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !INPUT_KEYBOARD_H
|