mirror of
https://github.com/izzy2lost/vba10.git
synced 2026-03-26 18:15:30 -07:00
47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
#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));
|
|
|
|
if (EmulatorSettings::Current->TurboBehavior == 0)
|
|
this->state.TurboTogglePressed = (bool)(window->GetKeyState(GetTurboKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
else
|
|
this->state.TurboPressed = (bool)(window->GetKeyState(GetTurboKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
this->state.StartPressed = (bool)(window->GetKeyState(GetStartKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
this->state.SelectPressed = (bool)(window->GetKeyState(GetSelectKeyBinding()) & CoreVirtualKeyStates::Down);
|
|
|
|
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);
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
} |