Orxonox  0.0.5 Codename: Arcturus
Win32KeyBoard.h
Go to the documentation of this file.
1 /*
2 The zlib/libpng License
3 
4 Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
5 
6 This software is provided 'as-is', without any express or implied warranty. In no event will
7 the authors be held liable for any damages arising from the use of this software.
8 
9 Permission is granted to anyone to use this software for any purpose, including commercial
10 applications, and to alter it and redistribute it freely, subject to the following
11 restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not claim that
14  you wrote the original software. If you use this software in a product,
15  an acknowledgment in the product documentation would be appreciated but is
16  not required.
17 
18  2. Altered source versions must be plainly marked as such, and must not be
19  misrepresented as being the original software.
20 
21  3. This notice may not be removed or altered from any source distribution.
22 */
23 #ifndef _WIN32_KEYBOARD_H_EADER_
24 #define _WIN32_KEYBOARD_H_EADER_
25 
26 #include "OISKeyboard.h"
27 #include "win32/Win32Prereqs.h"
28 
29 namespace OIS
30 {
31  class Win32Keyboard : public Keyboard
32  {
33  public:
44  Win32Keyboard(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings);
45  virtual ~Win32Keyboard();
46 
48  virtual bool isKeyDown(KeyCode key) const;
49 
51  virtual const std::string& getAsString(KeyCode kc);
52 
54  virtual void copyKeyStates(char keys[256]) const;
55 
57  virtual void setBuffered(bool buffered);
58 
60  virtual void capture();
61 
64 
66  virtual void _initialize();
67  protected:
68  void _readBuffered();
69  void _read();
70 
71  IDirectInput8* mDirectInput;
72  IDirectInputDevice8* mKeyboard;
73  DWORD coopSetting;
74 
75  unsigned char KeyBuffer[256];
76 
78  int _translateText( KeyCode kc );
79 
81  WCHAR deadKey;
82 
85  };
86 }
87 #endif //_WIN32_KEYBOARD_H_EADER_
Win32Keyboard(InputManager *creator, IDirectInput8 *pDI, bool buffered, DWORD coopSettings)
Definition: Win32KeyBoard.cpp:32
unsigned char KeyBuffer[256]
Definition: Win32KeyBoard.h:75
virtual void setBuffered(bool buffered)
Definition: Win32KeyBoard.cpp:319
IDirectInput8 * mDirectInput
Definition: Win32KeyBoard.h:71
An Object's interface is a way to gain write access to devices which support it.
Definition: OISInterface.h:34
::std::string string
Definition: gtest-port.h:756
IType
Type of Interface.
Definition: OISInterface.h:40
DWORD coopSetting
Definition: Win32KeyBoard.h:73
void _read()
Definition: Win32KeyBoard.cpp:204
IDirectInputDevice8 * mKeyboard
Definition: Win32KeyBoard.h:72
KeyCode
Keyboard scan codes.
Definition: OISKeyboard.h:31
virtual void capture()
Definition: Win32KeyBoard.cpp:93
virtual const std::string & getAsString(KeyCode kc)
Definition: Win32KeyBoard.cpp:289
int _translateText(KeyCode kc)
Internal method for translating KeyCodes to Text.
Definition: Win32KeyBoard.cpp:226
virtual bool isKeyDown(KeyCode key) const
Definition: Win32KeyBoard.cpp:283
std::string mGetString
used for getAsString
Definition: Win32KeyBoard.h:84
virtual void copyKeyStates(char keys[256]) const
Definition: Win32KeyBoard.cpp:312
virtual bool buffered() const
Definition: OISObject.h:44
virtual ~Win32Keyboard()
Definition: Win32KeyBoard.cpp:81
virtual Interface * queryInterface(Interface::IType type)
Definition: Win32KeyBoard.h:63
Base Manager class.
Definition: OISInputManager.h:38
Definition: EventHelpers.h:31
Definition: Win32KeyBoard.h:31
virtual void _initialize()
Definition: Win32KeyBoard.cpp:46
Type type() const
Definition: OISObject.h:38
Keyboard base class.
Definition: OISKeyboard.h:211
WCHAR deadKey
Stored dead key from last translation.
Definition: Win32KeyBoard.h:81
void _readBuffered()
Definition: Win32KeyBoard.cpp:102