2015-06-06 23:38:27 +00:00
|
|
|
#include "KeyboardInput.h"
|
|
|
|
|
#include "EmulatorSettings.h"
|
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
|
|
namespace VBA10
|
|
|
|
|
{
|
|
|
|
|
KeyboardInput::KeyboardInput(void)
|
|
|
|
|
: window(CoreWindow::GetForCurrentThread())
|
|
|
|
|
{
|
|
|
|
|
ZeroMemory(&state, sizeof(ControllerState));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KeyboardInput::~KeyboardInput(void)
|
|
|
|
|
{
|
|
|
|
|
this->window = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ControllerState *KeyboardInput::GetControllerState(void)
|
|
|
|
|
{
|
|
|
|
|
return &this->state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KeyboardInput::Update(void)
|
|
|
|
|
{
|
|
|
|
|
ZeroMemory(&state, sizeof(ControllerState));
|
|
|
|
|
|
2015-09-19 17:01:09 +00:00
|
|
|
if (EmulatorSettings::Current->TurboBehavior == 0)
|
|
|
|
|
this->state.TurboTogglePressed = (bool)(window->GetKeyState(GetTurboKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
else
|
|
|
|
|
this->state.TurboPressed = (bool)(window->GetKeyState(GetTurboKeyBinding()) & CoreVirtualKeyStates::Down);
|
2015-06-06 23:38:27 +00:00
|
|
|
|
2015-06-12 04:26:48 +00:00
|
|
|
this->state.StartPressed = (bool)(window->GetKeyState(GetStartKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.SelectPressed = (bool)(window->GetKeyState(GetSelectKeyBinding()) & CoreVirtualKeyStates::Down);
|
2015-06-09 14:58:55 +00:00
|
|
|
|
2015-06-12 04:26:48 +00:00
|
|
|
this->state.APressed = (bool)(window->GetKeyState(GetAKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.BPressed = (bool)(window->GetKeyState(GetBKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.LPressed = (bool)(window->GetKeyState(GetLKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.RPressed = (bool)(window->GetKeyState(GetRKeyBinding()) & CoreVirtualKeyStates::Down);
|
2015-07-30 17:54:28 +00:00
|
|
|
|
2015-06-06 23:38:27 +00:00
|
|
|
|
2015-07-30 17:54:28 +00:00
|
|
|
this->state.LeftPressed = (bool)(window->GetKeyState(GetLeftKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.RightPressed = (bool)(window->GetKeyState(GetRightKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.UpPressed = (bool)(window->GetKeyState(GetUpKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
|
this->state.DownPressed = (bool)(window->GetKeyState(GetDownKeyBinding()) & CoreVirtualKeyStates::Down);
|
2015-06-06 23:38:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|