2016-09-02 19:36:37 -04:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <thread>
|
|
|
|
#include <unordered_set>
|
2017-09-08 10:38:41 -04:00
|
|
|
#include "../Utilities/SimpleLock.h"
|
2016-09-02 19:36:37 -04:00
|
|
|
#include "EmulationSettings.h"
|
|
|
|
|
|
|
|
class ShortcutKeyHandler
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
std::thread _thread;
|
|
|
|
atomic<bool> _stopThread;
|
2017-09-08 10:38:41 -04:00
|
|
|
SimpleLock _lock;
|
2016-09-02 19:36:37 -04:00
|
|
|
|
2017-09-08 10:38:41 -04:00
|
|
|
int _keySetIndex;
|
|
|
|
vector<uint32_t> _pressedKeys;
|
2017-09-17 10:25:20 -04:00
|
|
|
vector<uint32_t> _lastPressedKeys;
|
|
|
|
bool _isKeyUp;
|
2017-09-08 10:38:41 -04:00
|
|
|
|
2017-09-08 11:25:10 -04:00
|
|
|
std::unordered_set<uint32_t> _keysDown[2];
|
|
|
|
std::unordered_set<uint32_t> _prevKeysDown[2];
|
2016-09-03 10:49:54 -04:00
|
|
|
|
2017-09-08 10:38:41 -04:00
|
|
|
void CheckMappedKeys();
|
2016-09-03 10:49:54 -04:00
|
|
|
|
2017-09-08 10:38:41 -04:00
|
|
|
bool IsKeyPressed(EmulatorShortcut key);
|
2017-09-17 10:25:20 -04:00
|
|
|
bool IsKeyPressed(KeyCombination comb);
|
2017-09-08 10:38:41 -04:00
|
|
|
|
|
|
|
bool DetectKeyPress(EmulatorShortcut key);
|
|
|
|
bool DetectKeyRelease(EmulatorShortcut key);
|
2016-09-02 19:36:37 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
ShortcutKeyHandler();
|
|
|
|
~ShortcutKeyHandler();
|
2017-09-08 10:38:41 -04:00
|
|
|
|
|
|
|
void ProcessKeys();
|
2016-09-02 19:36:37 -04:00
|
|
|
};
|