![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <keyboard.hpp>
Public Member Functions | |
Keyboard (NotNull< HWND > window, IDirectInput8 &di) | |
Keyboard (const Keyboard &keyboard)=delete | |
Keyboard (Keyboard &&keyboard) noexcept | |
~Keyboard () | |
Keyboard & | operator= (const Keyboard &keyboard)=delete |
Keyboard & | operator= (Keyboard &&keyboard)=delete |
NotNull< HWND > | GetWindow () noexcept |
void | Update () noexcept |
bool | IsActive (U8 key) const noexcept |
bool | IsPassive (U8 key) const noexcept |
bool | IsSwitched (U8 key) const noexcept |
bool | IsActivated (U8 key) const noexcept |
bool | IsDeactivated (U8 key) const noexcept |
Private Member Functions | |
void | InitializeKeyboard () |
Private Attributes | |
NotNull< HWND > | m_window |
IDirectInput8 & | m_di |
ComPtr< IDirectInputDevice8 > | m_keyboard |
std::bitset< 512 > | m_key_states |
A class of keyboards.
|
explicit |
Constructs a keyboard.
[in] | window | The handle of the parent window. |
[in,out] | di | A reference to a direct input object. |
Exception | Failed to initialize the keyboard. |
|
delete |
Constructs a keyboard from the given keyboard.
[in] | keyboard | A reference to the keyboard to copy. |
|
defaultnoexcept |
Constructs a keyboard by moving the given keyboard.
[in] | keyboard | A reference to the keyboard to move. |
|
default |
Destructs this keyboard.
|
noexcept |
Returns the window handle of this keyboard.
|
private |
Initializes the keyboard device of this keyboard.
Exception | Failed to initialize the keyboard. |
|
noexcept |
Checks whether the given key is activated.
[in] | key | The key. |
true
if the given key is activated. false
otherwise.
|
noexcept |
Checks whether the given key is active.
[in] | key | The key. |
true
if the given key is active. false
otherwise.
|
noexcept |
Checks whether the given key is deactivated.
[in] | key | The key. |
true
if the given key is deactivated. false
otherwise.
|
noexcept |
Checks whether the given key is passive.
[in] | key | The key. |
true
if the given key is passive. false
otherwise.
|
noexcept |
Checks whether the given key is switched from being passive to active or vice versa (i.e. activated or deactivated).
[in] | key | The key. |
true
if the given key is switched from being passive to active or vice versa (i.e. activated or deactivated). false
otherwise. Copies the given keyboard to this keyboard.
[in] | keyboard | A reference to the keyboard to copy. |
Moves the given keyboard to this keyboard.
[in] | keyboard | A reference to the keyboard to move. |
|
noexcept |
Updates the state of this keyboard.
|
private |
A reference to the DirectInput object of this keyboard.
|
private |
The key states of this keyboard. Each key state consists of two flags.
The first flag indicates whether the key state switched from being passive to active or vice versa (i.e. activated or deactivated).
The second flag indicates whether the key state is active.
|
private |
A pointer to the DirectInput keyboard device of this keyboard.
|
private |
The handle of the parent window of this keyboard.