35 lines
704 B
C++
35 lines
704 B
C++
#pragma once
|
|
|
|
#include "../Core/Action.h"
|
|
|
|
#include <map>
|
|
#include <set>
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
using sfKey = sf::Keyboard::Key;
|
|
|
|
static const int NUMBER_OF_KEYBINDS = 5;
|
|
static const int CUSTOMIZABLE_KEYBINDS = NUMBER_OF_KEYBINDS - 1;
|
|
|
|
|
|
class Keybinds {
|
|
private:
|
|
std::map<Action, std::set<sfKey>> keybinds;
|
|
int layoutNumber;
|
|
|
|
public:
|
|
Keybinds(int layoutNumber);
|
|
|
|
void loadKeybindsFromFile();
|
|
|
|
void saveKeybindsToFile() const;
|
|
|
|
void addKey(Action action, sfKey key);
|
|
|
|
void clearKeys(Action action);
|
|
|
|
const std::set<Action> getActions(sfKey key) const;
|
|
|
|
const std::set<sfKey>& getKeybinds(Action action) const;
|
|
};
|