35 lines
774 B
C++
35 lines
774 B
C++
#ifndef HOLESOME_KEY_FEATURES_HPP
|
|
#define HOLESOME_KEY_FEATURES_HPP
|
|
|
|
|
|
#include "direction.h"
|
|
#include "input_identity.h"
|
|
#include "../../config.h"
|
|
#include "input_device_group.h"
|
|
|
|
struct KeyFeatures
|
|
{
|
|
sf::Keyboard::Key key;
|
|
HardDirection hardDirection = HardDirection::NONE;
|
|
InputDeviceGroup deviceGroup = InputDeviceGroup::UNKNOWN;
|
|
|
|
explicit KeyFeatures(sf::Keyboard::Key key);
|
|
};
|
|
|
|
KeyFeatures::KeyFeatures(sf::Keyboard::Key key)
|
|
{
|
|
this->key = key;
|
|
hardDirection = Direction::getKeyDirection(key);
|
|
|
|
// Determine device group
|
|
for (const auto& groupKeys: KEY_GROUPS)
|
|
{
|
|
if (groupKeys.second.contains(key))
|
|
{
|
|
deviceGroup = groupKeys.first;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif //HOLESOME_KEY_FEATURES_HPP
|