fini menu keybinds

This commit is contained in:
2025-03-25 20:06:02 +01:00
parent de8a5e6e34
commit b2567844fc
10 changed files with 199 additions and 161 deletions

View File

@@ -57,11 +57,16 @@ class AppMenu {
} }
} }
void placeText(sf::Text& text, const PlayerCursor& playerCursor, const sf::String& string, float xPos, float yPos, const sf::Vector2u& cursorPos) const { void placeText(sf::Text& text, const std::optional<PlayerCursor>& playerCursor, const sf::String& string, float xPos, float yPos, const std::optional<sf::Vector2u>& cursorPos) const {
float sizeMultiplier = this->settings->getWindowSizeMultiplier(); float sizeMultiplier = this->settings->getWindowSizeMultiplier();
text.setString(string); text.setString(string);
text.setOutlineThickness((playerCursor.getPosition() == cursorPos) ? (sizeMultiplier / 2) : 0); if (playerCursor.has_value() && cursorPos.has_value()) {
text.setOutlineThickness((playerCursor.value().getPosition() == cursorPos.value()) ? (sizeMultiplier / 2) : 0);
}
else {
text.setOutlineThickness(0);
}
text.setOrigin(sf::Vector2f({0, text.getLocalBounds().size.y / 2})); text.setOrigin(sf::Vector2f({0, text.getLocalBounds().size.y / 2}));
text.setPosition(sf::Vector2f({sizeMultiplier * xPos, sizeMultiplier * yPos})); text.setPosition(sf::Vector2f({sizeMultiplier * xPos, sizeMultiplier * yPos}));
this->renderWindow->draw(text); this->renderWindow->draw(text);

View File

@@ -60,17 +60,17 @@ void GameSettingsAppMenu::drawFrame() const {
text.setFillColor(sf::Color(0, 0, 0)); text.setFillColor(sf::Color(0, 0, 0));
text.setOutlineColor(sf::Color(255, 255, 255)); text.setOutlineColor(sf::Color(255, 255, 255));
this->placeTitle(text, std::optional<PlayerCursor>(), "GAME SETTINGS", 5.f, std::optional<sf::Vector2u>()); this->placeTitle(text, {}, "GAME SETTINGS", 5.f, {});
this->placeText(text, this->playerCursor, "PIECES SELECT (TODO)", 5.f, 15.f, {0, 0}); this->placeText(text, this->playerCursor, "PIECES SELECT (TODO)", 5.f, 15.f, sf::Vector2u{0, 0});
this->placeText(text, this->playerCursor, "BOARD SELECT (TODO)", 40.f, 15.f, {1, 0}); this->placeText(text, this->playerCursor, "BOARD SELECT (TODO)", 40.f, 15.f, sf::Vector2u{1, 0});
this->placeText(text, this->playerCursor, "SPRINT", 5.f, 25.f, {0, 1}); this->placeText(text, this->playerCursor, "SPRINT", 5.f, 25.f, sf::Vector2u{0, 1});
this->placeText(text, this->playerCursor, "MARATHON", 25.f, 25.f, {1, 1}); this->placeText(text, this->playerCursor, "MARATHON", 25.f, 25.f, sf::Vector2u{1, 1});
this->placeText(text, this->playerCursor, "ULTRA", 50.f, 25.f, {2, 1}); this->placeText(text, this->playerCursor, "ULTRA", 50.f, 25.f, sf::Vector2u{2, 1});
this->placeText(text, this->playerCursor, "MASTER", 5.f, 35.f, {0, 2}); this->placeText(text, this->playerCursor, "MASTER", 5.f, 35.f, sf::Vector2u{0, 2});
this->placeText(text, this->playerCursor, "??? (TODO)", 25.f, 35.f, {1, 2}); this->placeText(text, this->playerCursor, "??? (TODO)", 25.f, 35.f, sf::Vector2u{1, 2});
this->placeText(text, this->playerCursor, "??? (TODO)", 50.f, 35.f, {2, 2}); this->placeText(text, this->playerCursor, "??? (TODO)", 50.f, 35.f, sf::Vector2u{2, 2});
this->renderWindow->display(); this->renderWindow->display();
} }

View File

@@ -47,11 +47,11 @@ void MainAppMenu::drawFrame() const {
text.setFillColor(sf::Color(0, 0, 0)); text.setFillColor(sf::Color(0, 0, 0));
text.setOutlineColor(sf::Color(255, 255, 255)); text.setOutlineColor(sf::Color(255, 255, 255));
this->placeTitle(text, std::optional<PlayerCursor>(), "JMINOS", 10.f, std::optional<sf::Vector2u>()); this->placeTitle(text, {}, "JMINOS", 10.f, {});
this->placeTitle(text, this->playerCursor, "PLAY", 20.f, sf::Vector2u({0, 0})); this->placeTitle(text, this->playerCursor, "PLAY", 20.f, sf::Vector2u{0, 0});
this->placeTitle(text, this->playerCursor, "SETTINGS", 30.f, sf::Vector2u({0, 1})); this->placeTitle(text, this->playerCursor, "SETTINGS", 30.f, sf::Vector2u{0, 1});
this->placeTitle(text, this->playerCursor, "INFO (TODO)", 40.f, sf::Vector2u({0, 2})); this->placeTitle(text, this->playerCursor, "INFO (TODO)", 40.f, sf::Vector2u{0, 2});
this->renderWindow->display(); this->renderWindow->display();
} }

View File

@@ -65,13 +65,13 @@ void SettingsControlsAppMenu::drawFrame() const {
text.setFillColor(sf::Color(0, 0, 0)); text.setFillColor(sf::Color(0, 0, 0));
text.setOutlineColor(sf::Color(255, 255, 255)); text.setOutlineColor(sf::Color(255, 255, 255));
this->placeTitle(text, std::optional<PlayerCursor>(), "CONTROLS SETTINGS", 5.f, std::optional<sf::Vector2u>()); this->placeTitle(text, {}, "CONTROLS SETTINGS", 5.f, {});
sf::Vector2u windowSize = this->renderWindow->getSize(); sf::Vector2u windowSize = this->renderWindow->getSize();
this->placeText(text, this->playerCursor, "< DAS: " + std::to_string(playerControls.getDAS()) + " >", 5.f, 15.f, {0, 0}); this->placeText(text, this->playerCursor, "< DAS: " + std::to_string(playerControls.getDAS()) + " >", 5.f, 15.f, sf::Vector2u{0, 0});
this->placeText(text, this->playerCursor, "< ARR: " + std::to_string(playerControls.getARR()) + " >", 5.f, 25.f, {0, 1}); this->placeText(text, this->playerCursor, "< ARR: " + std::to_string(playerControls.getARR()) + " >", 5.f, 25.f, sf::Vector2u{0, 1});
this->placeText(text, this->playerCursor, "< SDR: " + std::to_string(playerControls.getSDR()) + " >", 5.f, 35.f, {0, 2}); this->placeText(text, this->playerCursor, "< SDR: " + std::to_string(playerControls.getSDR()) + " >", 5.f, 35.f, sf::Vector2u{0, 2});
this->renderWindow->display(); this->renderWindow->display();
} }

View File

@@ -9,6 +9,7 @@
#include <string> #include <string>
#include <regex> #include <regex>
#include <filesystem> #include <filesystem>
#include <algorithm>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
@@ -16,6 +17,8 @@ SettingsKeybindsAppMenu::SettingsKeybindsAppMenu(std::shared_ptr<MenuStack> menu
AppMenu(menuStack, settings, renderWindow), AppMenu(menuStack, settings, renderWindow),
playerCursor(std::vector<unsigned int>(12, 1)) { playerCursor(std::vector<unsigned int>(12, 1)) {
this->selectedAnAction = false;
for (Action action : ACTION_LIST_IN_ORDER) { for (Action action : ACTION_LIST_IN_ORDER) {
std::string textureName = ACTION_NAMES[action]; std::string textureName = ACTION_NAMES[action];
textureName = std::regex_replace(textureName, std::regex(" "), ""); textureName = std::regex_replace(textureName, std::regex(" "), "");
@@ -27,20 +30,44 @@ SettingsKeybindsAppMenu::SettingsKeybindsAppMenu(std::shared_ptr<MenuStack> menu
void SettingsKeybindsAppMenu::computeFrame() { void SettingsKeybindsAppMenu::computeFrame() {
this->updateMetaBinds(); this->updateMetaBinds();
this->playerCursor.updatePosition();
if (this->playerCursor.movedLeft()) { if (!this->selectedAnAction) {
this->settings->selectPreviousKeybinds(); this->playerCursor.updatePosition();
if (this->playerCursor.movedLeft()) {
this->settings->selectPreviousKeybinds();
}
if (this->playerCursor.movedRight()) {
this->settings->selectNextKeybinds();
}
} }
if (this->playerCursor.movedRight()) { else {
this->settings->selectNextKeybinds(); bool addedKeybind = false;
for (const auto& [key, string] : KEYS_TO_STRING) {
if (sf::Keyboard::isKeyPressed(key) && (key != sfKey::Enter) && (key != sfKey::Escape)) {
this->settings->getKeybinds().addKey(this->actionSelected, key);
addedKeybind = true;
}
if (addedKeybind) {
this->selectedAnAction = false;
break;
}
}
} }
if (this->enterReleased) { if (this->enterReleased && this->settings->getKeybinds().isModifiable()) {
//TODO this->selectedAnAction = !selectedAnAction;
this->actionSelected = ACTION_LIST_IN_ORDER[this->playerCursor.getPosition().y - 1];
} }
if (this->escReleased) { if (this->escReleased) {
this->menuStack->pop(); if (this->selectedAnAction) {
this->settings->getKeybinds().clearKeys(this->actionSelected);
this->selectedAnAction = false;
}
else {
this->menuStack->pop();
}
} }
} }
@@ -51,32 +78,45 @@ void SettingsKeybindsAppMenu::drawFrame() const {
text.setFillColor(sf::Color(0, 0, 0)); text.setFillColor(sf::Color(0, 0, 0));
text.setOutlineColor(sf::Color(255, 255, 255)); text.setOutlineColor(sf::Color(255, 255, 255));
this->placeTitle(text, std::optional<PlayerCursor>(), "KEYBINDS SETTINGS", 5.f, std::optional<sf::Vector2u>()); this->placeTitle(text, {}, "KEYBINDS SETTINGS", 5.f, {});
if (this->settings->getKeybindsLayout() == CUSTOMIZABLE_KEYBINDS) { if (this->settings->getKeybindsLayout() == CUSTOMIZABLE_KEYBINDS) {
this->placeText(text, this->playerCursor, "< CUSTOM >", 5.f, 15.f, {0, 0}); this->placeText(text, this->playerCursor, "< CUSTOM >", 5.f, 15.f, sf::Vector2u{0, 0});
} }
else { else {
this->placeText(text, this->playerCursor, "< DEFAULT " + std::to_string(this->settings->getKeybindsLayout() + 1) + " >", 5.f, 15.f, {0, 0}); this->placeText(text, this->playerCursor, "< DEFAULT " + std::to_string(this->settings->getKeybindsLayout() + 1) + " >", 5.f, 15.f, sf::Vector2u{0, 0});
}
if (this->selectedAnAction) {
text.setOutlineColor(sf::Color(255, 0, 0));
} }
int i = 0; int i = 0;
int firstElem = (this->playerCursor.getPosition().y == 0) ? (unsigned int) 0 : (this->playerCursor.getPosition().y - 1); int firstElem = std::clamp(((int) this->playerCursor.getPosition().y) - 1, 0, 8);
for (Action action : ACTION_LIST_IN_ORDER) { for (Action action : ACTION_LIST_IN_ORDER) {
if (i >= firstElem && i < (firstElem + 3)) { if (i >= firstElem && i < (firstElem + 3)) {
sf::String string; sf::String string;
bool firstKey = true;
for (sfKey key : this->settings->getKeybinds().getKeybinds(action)) { for (sfKey key : this->settings->getKeybinds().getKeybinds(action)) {
auto keyString = getKeyStringRepresentation(key); if (KEYS_TO_STRING.contains(key)) {
if (keyString.has_value()) { std::string keyString = KEYS_TO_STRING.at(key);
string += keyString.value() + " "; if (firstKey) {
string += keyString;
firstKey = false;
}
else {
string += ", " + keyString;
}
} }
} }
this->placeText(text, this->playerCursor, setStringToUpperCase(ACTION_NAMES[action]), 20.f, ((i - firstElem) * 10) + 25.f, {0, (unsigned int) i + 1});
this->placeText(text, this->playerCursor, string, 50.f, ((i - firstElem) * 10) + 25.f, {0, (unsigned int) i + 1}); this->placeText(text, this->playerCursor, setStringToUpperCase(ACTION_NAMES[action]), 15.f, ((i - firstElem) * 10) + 25.f, sf::Vector2u{0, (unsigned int) i + 1});
this->placeText(text, {}, string, 40.f, ((i - firstElem) * 10) + 25.f, {});
sf::Sprite sprite(this->iconTextures[action]); sf::Sprite sprite(this->iconTextures[action]);
sprite.setOrigin(sprite.getLocalBounds().getCenter()); sprite.setOrigin(sprite.getLocalBounds().getCenter());
sprite.setPosition(sf::Vector2f(10.f, ((i - firstElem) * 10) + 25.f) * (float) this->settings->getWindowSizeMultiplier()); sprite.setPosition(sf::Vector2f(8.f, ((i - firstElem) * 10) + 25.f) * (float) this->settings->getWindowSizeMultiplier());
sprite.setScale(sprite.getScale() * ((float) this->settings->getWindowSizeMultiplier() / 2)); sprite.setScale(sprite.getScale() * ((float) this->settings->getWindowSizeMultiplier() / 2));
this->renderWindow->draw(sprite); this->renderWindow->draw(sprite);
} }

View File

@@ -12,6 +12,8 @@ class SettingsKeybindsAppMenu : public AppMenu {
private: private:
PlayerCursor playerCursor; PlayerCursor playerCursor;
sf::Texture iconTextures[11]; sf::Texture iconTextures[11];
bool selectedAnAction;
Action actionSelected;
public: public:
SettingsKeybindsAppMenu(std::shared_ptr<MenuStack> menuStack, std::shared_ptr<Settings> settings, std::shared_ptr<sf::RenderWindow> renderWindow); SettingsKeybindsAppMenu(std::shared_ptr<MenuStack> menuStack, std::shared_ptr<Settings> settings, std::shared_ptr<sf::RenderWindow> renderWindow);

View File

@@ -66,14 +66,14 @@ void SettingsMainAppMenu::drawFrame() const {
text.setFillColor(sf::Color(0, 0, 0)); text.setFillColor(sf::Color(0, 0, 0));
text.setOutlineColor(sf::Color(255, 255, 255)); text.setOutlineColor(sf::Color(255, 255, 255));
this->placeTitle(text, std::optional<PlayerCursor>(), "SETTINGS", 5.f, std::optional<sf::Vector2u>()); this->placeTitle(text, {}, "SETTINGS", 5.f, {});
sf::Vector2u windowSize = this->renderWindow->getSize(); sf::Vector2u windowSize = this->renderWindow->getSize();
this->placeText(text, this->playerCursor, "CHANGE KEYBINDS", 5.f, 15.f, {0, 0}); this->placeText(text, this->playerCursor, "CHANGE KEYBINDS", 5.f, 15.f, sf::Vector2u{0, 0});
this->placeText(text, this->playerCursor, "CHANGE CONTROLS", 5.f, 25.f, {0, 1}); this->placeText(text, this->playerCursor, "CHANGE CONTROLS", 5.f, 25.f, sf::Vector2u{0, 1});
this->placeText(text, this->playerCursor, "< WINDOW SIZE: " + std::to_string(windowSize.x) + "x" + std::to_string(windowSize.y) + " >", 5.f, 35.f, {0, 2}); this->placeText(text, this->playerCursor, "< WINDOW SIZE: " + std::to_string(windowSize.x) + "x" + std::to_string(windowSize.y) + " >", 5.f, 35.f, sf::Vector2u{0, 2});
this->placeText(text, this->playerCursor, "< VOLUME: " + std::to_string(this->settings->getMasterVolume()) + "% >", 5.f, 45.f, {0, 3}); this->placeText(text, this->playerCursor, "< VOLUME: " + std::to_string(this->settings->getMasterVolume()) + "% >", 5.f, 45.f, sf::Vector2u{0, 3});
this->renderWindow->display(); this->renderWindow->display();
} }

View File

@@ -66,7 +66,7 @@ void Keybinds::saveKeybindsToFile() const {
void Keybinds::addKey(Action action, sfKey key) { void Keybinds::addKey(Action action, sfKey key) {
if (!this->modifiable) return; if (!this->modifiable) return;
if (!getKeyStringRepresentation(key).has_value()) return; if (!KEYS_TO_STRING.contains(key)) return;
this->keybinds.at(action).insert(key); this->keybinds.at(action).insert(key);
} }

View File

@@ -18,7 +18,7 @@ class Keybinds {
std::map<Action, std::set<sfKey>> keybinds; std::map<Action, std::set<sfKey>> keybinds;
int layoutNumber; int layoutNumber;
bool modifiable; bool modifiable;
public: public:
Keybinds(int layoutNumber); Keybinds(int layoutNumber);
@@ -45,123 +45,112 @@ inline std::string setStringToUpperCase(std::string&& str) {
inline std::string setStringToUpperCase(const std::string& str) { inline std::string setStringToUpperCase(const std::string& str) {
std::string result = str; std::string result = str;
std::transform(str.begin(), str.end(), result.begin(), ::toupper); std::transform(result.begin(), result.end(), result.begin(), ::toupper);
return result; return result;
} }
inline const std::optional<sf::String> getKeyStringRepresentation(sfKey key) { #define INSERT_MAPPING(identifier) {sfKey::identifier, setStringToUpperCase(#identifier)}
#define INSERT_MAPPING(identifier) {sfKey::identifier, setStringToUpperCase(#identifier)} static const std::map<sfKey, sf::String> KEYS_TO_STRING = {
INSERT_MAPPING(A),
static const std::map<sfKey, sf::String> keysRepresentation { INSERT_MAPPING(B),
INSERT_MAPPING(A), INSERT_MAPPING(C),
INSERT_MAPPING(B), INSERT_MAPPING(D),
INSERT_MAPPING(C), INSERT_MAPPING(E),
INSERT_MAPPING(D), INSERT_MAPPING(F),
INSERT_MAPPING(E), INSERT_MAPPING(G),
INSERT_MAPPING(F), INSERT_MAPPING(H),
INSERT_MAPPING(G), INSERT_MAPPING(I),
INSERT_MAPPING(H), INSERT_MAPPING(J),
INSERT_MAPPING(I), INSERT_MAPPING(K),
INSERT_MAPPING(J), INSERT_MAPPING(L),
INSERT_MAPPING(K), INSERT_MAPPING(M),
INSERT_MAPPING(L), INSERT_MAPPING(N),
INSERT_MAPPING(M), INSERT_MAPPING(O),
INSERT_MAPPING(N), INSERT_MAPPING(P),
INSERT_MAPPING(O), INSERT_MAPPING(Q),
INSERT_MAPPING(P), INSERT_MAPPING(R),
INSERT_MAPPING(Q), INSERT_MAPPING(S),
INSERT_MAPPING(R), INSERT_MAPPING(T),
INSERT_MAPPING(S), INSERT_MAPPING(U),
INSERT_MAPPING(T), INSERT_MAPPING(V),
INSERT_MAPPING(U), INSERT_MAPPING(W),
INSERT_MAPPING(V), INSERT_MAPPING(X),
INSERT_MAPPING(W), INSERT_MAPPING(Y),
INSERT_MAPPING(X), INSERT_MAPPING(Z),
INSERT_MAPPING(Y), INSERT_MAPPING(Num0),
INSERT_MAPPING(Z), INSERT_MAPPING(Num1),
INSERT_MAPPING(Num0), INSERT_MAPPING(Num2),
INSERT_MAPPING(Num1), INSERT_MAPPING(Num3),
INSERT_MAPPING(Num2), INSERT_MAPPING(Num4),
INSERT_MAPPING(Num3), INSERT_MAPPING(Num5),
INSERT_MAPPING(Num4), INSERT_MAPPING(Num6),
INSERT_MAPPING(Num5), INSERT_MAPPING(Num7),
INSERT_MAPPING(Num6), INSERT_MAPPING(Num8),
INSERT_MAPPING(Num7), INSERT_MAPPING(Num9),
INSERT_MAPPING(Num8), INSERT_MAPPING(Escape),
INSERT_MAPPING(Num9), INSERT_MAPPING(LControl),
INSERT_MAPPING(Escape), INSERT_MAPPING(LShift),
INSERT_MAPPING(LControl), INSERT_MAPPING(LAlt),
INSERT_MAPPING(LShift), INSERT_MAPPING(LSystem),
INSERT_MAPPING(LAlt), INSERT_MAPPING(RControl),
INSERT_MAPPING(LSystem), INSERT_MAPPING(RShift),
INSERT_MAPPING(RControl), INSERT_MAPPING(RAlt),
INSERT_MAPPING(RShift), INSERT_MAPPING(RSystem),
INSERT_MAPPING(RAlt), INSERT_MAPPING(Menu),
INSERT_MAPPING(RSystem), INSERT_MAPPING(LBracket),
INSERT_MAPPING(Menu), INSERT_MAPPING(RBracket),
INSERT_MAPPING(LBracket), INSERT_MAPPING(Semicolon),
INSERT_MAPPING(RBracket), INSERT_MAPPING(Comma),
INSERT_MAPPING(Semicolon), INSERT_MAPPING(Period),
INSERT_MAPPING(Comma), INSERT_MAPPING(Apostrophe),
INSERT_MAPPING(Period), INSERT_MAPPING(Slash),
INSERT_MAPPING(Apostrophe), INSERT_MAPPING(Backslash),
INSERT_MAPPING(Slash), INSERT_MAPPING(Grave),
INSERT_MAPPING(Backslash), INSERT_MAPPING(Equal),
INSERT_MAPPING(Grave), INSERT_MAPPING(Hyphen),
INSERT_MAPPING(Equal), INSERT_MAPPING(Space),
INSERT_MAPPING(Hyphen), INSERT_MAPPING(Enter),
INSERT_MAPPING(Space), INSERT_MAPPING(Backspace),
INSERT_MAPPING(Enter), INSERT_MAPPING(Tab),
INSERT_MAPPING(Backspace), INSERT_MAPPING(PageUp),
INSERT_MAPPING(Tab), INSERT_MAPPING(PageDown),
INSERT_MAPPING(PageUp), INSERT_MAPPING(End),
INSERT_MAPPING(PageDown), INSERT_MAPPING(Home),
INSERT_MAPPING(End), INSERT_MAPPING(Insert),
INSERT_MAPPING(Home), INSERT_MAPPING(Delete),
INSERT_MAPPING(Insert), INSERT_MAPPING(Add),
INSERT_MAPPING(Delete), INSERT_MAPPING(Subtract),
INSERT_MAPPING(Add), INSERT_MAPPING(Multiply),
INSERT_MAPPING(Subtract), INSERT_MAPPING(Divide),
INSERT_MAPPING(Multiply), INSERT_MAPPING(Left),
INSERT_MAPPING(Divide), INSERT_MAPPING(Right),
INSERT_MAPPING(Left), INSERT_MAPPING(Up),
INSERT_MAPPING(Right), INSERT_MAPPING(Down),
INSERT_MAPPING(Up), INSERT_MAPPING(Numpad0),
INSERT_MAPPING(Down), INSERT_MAPPING(Numpad1),
INSERT_MAPPING(Numpad0), INSERT_MAPPING(Numpad2),
INSERT_MAPPING(Numpad1), INSERT_MAPPING(Numpad3),
INSERT_MAPPING(Numpad2), INSERT_MAPPING(Numpad4),
INSERT_MAPPING(Numpad3), INSERT_MAPPING(Numpad5),
INSERT_MAPPING(Numpad4), INSERT_MAPPING(Numpad6),
INSERT_MAPPING(Numpad5), INSERT_MAPPING(Numpad7),
INSERT_MAPPING(Numpad6), INSERT_MAPPING(Numpad8),
INSERT_MAPPING(Numpad7), INSERT_MAPPING(Numpad9),
INSERT_MAPPING(Numpad8), INSERT_MAPPING(F1),
INSERT_MAPPING(Numpad9), INSERT_MAPPING(F2),
INSERT_MAPPING(F1), INSERT_MAPPING(F3),
INSERT_MAPPING(F2), INSERT_MAPPING(F4),
INSERT_MAPPING(F3), INSERT_MAPPING(F5),
INSERT_MAPPING(F4), INSERT_MAPPING(F6),
INSERT_MAPPING(F5), INSERT_MAPPING(F7),
INSERT_MAPPING(F6), INSERT_MAPPING(F8),
INSERT_MAPPING(F7), INSERT_MAPPING(F9),
INSERT_MAPPING(F8), INSERT_MAPPING(F10),
INSERT_MAPPING(F9), INSERT_MAPPING(F11),
INSERT_MAPPING(F10), INSERT_MAPPING(F12),
INSERT_MAPPING(F11), INSERT_MAPPING(F13),
INSERT_MAPPING(F12), INSERT_MAPPING(F14),
INSERT_MAPPING(F13), INSERT_MAPPING(F15),
INSERT_MAPPING(F14), INSERT_MAPPING(Pause)
INSERT_MAPPING(F15), };
INSERT_MAPPING(Pause) #undef INSERT_MAPPING
};
#undef INSERT_MAPPING
if (keysRepresentation.contains(key)) {
return keysRepresentation.at(key);
}
else {
return {};
}
}

View File

@@ -89,6 +89,8 @@ void Settings::loadSettingsFromFile() {
} }
void Settings::saveSettingsToFile() const { void Settings::saveSettingsToFile() const {
this->keybinds.at(CUSTOMIZABLE_KEYBINDS).saveKeybindsToFile();
std::ofstream settingsFile("data/config/settings.bin", std::ios::trunc | std::ios::binary); std::ofstream settingsFile("data/config/settings.bin", std::ios::trunc | std::ios::binary);
char byte; char byte;