mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
27 lines
660 B
C++
27 lines
660 B
C++
#include "input/keyboard.hpp"
|
|
#include "platform-dx/implementations.hpp"
|
|
|
|
namespace xna {
|
|
KeyboardState Keyboard::GetState() {
|
|
if (!impl || !impl->_dxKeyboard)
|
|
return KeyboardState();
|
|
|
|
const auto state = Keyboard::impl->_dxKeyboard->GetState();
|
|
auto ptr = reinterpret_cast<const uint32_t*>(&state);
|
|
const auto xnaState = reinterpret_cast<const KeyboardState*>(ptr);
|
|
|
|
return *xnaState;
|
|
}
|
|
|
|
void Keyboard::Initialize() {
|
|
impl = uNew<PlatformImplementation>();
|
|
impl->_dxKeyboard = uNew<DirectX::Keyboard>();
|
|
}
|
|
|
|
bool Keyboard::IsConnected() {
|
|
if (!impl || !impl->_dxKeyboard)
|
|
return false;
|
|
|
|
return impl->_dxKeyboard->IsConnected();
|
|
}
|
|
} |