toujours plus de settings

This commit is contained in:
2025-03-22 10:49:55 +01:00
parent c25abec6ba
commit 0e17996c35
12 changed files with 78 additions and 9 deletions

View File

@@ -30,7 +30,7 @@ void Settings::saveSettingsToFile() const {
}
void Settings::createDefaultSettingsFile() const {
void Settings::resetSettingsFile() const {
}
@@ -50,6 +50,10 @@ bool Settings::canModifyCurrentKeybinds() const {
return (this->chosenKeybinds == CUSTOMIZABLE_KEYBINDS);
}
void Settings::setGamemode(Gamemode gamemode) {
this->gamemode = gamemode;
}
bool Settings::widenWindow() {
if (this->windowSizeMode < WINDOW_SIZE_LAST_MODE) {
this->windowSizeMode++;
@@ -62,8 +66,36 @@ bool Settings::shortenWindow() {
}
}
void Settings::setGamemode(Gamemode gamemode) {
this->gamemode = gamemode;
void Settings::selectPieces(PiecesType type, int value) {
this->selectedPieces.emplace_back(type, value);
}
void Settings::unselectPieces(int index) {
if (index >= this->selectedPieces.size()) return;
this->selectedPieces.erase(this->selectedPieces.begin() + index);
}
void Settings::confirmSelectedPieces() {
this->menu.getPiecesList().unselectAll();
for (const auto& [type, value] : this->selectedPieces) {
int size = getSizeOfPieces(type);
if (size == 0) {
switch (type) {
case CONVEX : {this->menu.getPiecesList().selectConvexPieces(value); break;}
case HOLELESS : {this->menu.getPiecesList().selectHolelessPieces(value); break;}
case OTHERS : {this->menu.getPiecesList().selectOtherPieces(value); break;}
case ALL : {this->menu.getPiecesList().selectAllPieces(value); break;}
}
}
else {
if (size > 15) return;
this->menu.getPiecesList().selectPiece(size, value);
}
}
}
Menu& Settings::getMenu() {
@@ -85,3 +117,7 @@ int Settings::getWindowSizeMultiplier() const {
const sf::VideoMode& Settings::getVideoMode() const {
return sf::VideoMode(BASE_WINDOW_SIZE * (unsigned int) WINDOW_SIZE_MULTIPLIERS[this->windowSizeMode]);
}
const std::vector<std::pair<PiecesType, int>>& Settings::getSelectedPieces() const {
return this->selectedPieces;
}