on peut changer les settings wtf
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
#include "../Core/Menu.h"
|
||||
#include "Keybinds.h"
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
static const sf::Vector2u BASE_WINDOW_SIZE = {80, 50};
|
||||
static const int WINDOW_SIZE_MULTIPLIERS[] = {4, 6, 10, 14, 20};
|
||||
static const int WINDOW_SIZE_MULTIPLIERS[] = {4, 6, 10, 14, 20, 30, 40};
|
||||
static const int WINDOW_SIZE_LAST_MODE = (sizeof(WINDOW_SIZE_MULTIPLIERS) / sizeof(int)) - 1;
|
||||
|
||||
|
||||
@@ -36,6 +37,10 @@ void Settings::loadSettingsFromFile() {
|
||||
settingsFile.get(byte);
|
||||
this->windowSizeMode = byte;
|
||||
|
||||
// master volume
|
||||
settingsFile.get(byte);
|
||||
this->masterVolume = byte;
|
||||
|
||||
// gamemode
|
||||
settingsFile.get(byte);
|
||||
this->gamemode = Gamemode(byte);
|
||||
@@ -77,6 +82,10 @@ void Settings::saveSettingsToFile() const {
|
||||
byte = this->windowSizeMode;
|
||||
settingsFile.write(&byte, 1);
|
||||
|
||||
// master volume
|
||||
byte = this->masterVolume;
|
||||
settingsFile.write(&byte, 1);
|
||||
|
||||
// gamemode
|
||||
byte = this->gamemode;
|
||||
settingsFile.write(&byte, 1);
|
||||
@@ -142,6 +151,22 @@ bool Settings::shortenWindow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Settings::raiseMasterVolume() {
|
||||
if (this->masterVolume < 100) {
|
||||
this->masterVolume = std::min(this->masterVolume + 5, 100);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Settings::lowerMasterVolume() {
|
||||
if (this->masterVolume > 0) {
|
||||
this->masterVolume = std::max(this->masterVolume - 5, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::selectPieces(PiecesType type, int value) {
|
||||
this->selectedPieces.emplace_back(type, value);
|
||||
}
|
||||
@@ -190,6 +215,10 @@ int Settings::getWindowSizeMultiplier() const {
|
||||
return WINDOW_SIZE_MULTIPLIERS[this->windowSizeMode];
|
||||
}
|
||||
|
||||
int Settings::getMasterVolume() const {
|
||||
return this->masterVolume;
|
||||
}
|
||||
|
||||
const sf::VideoMode Settings::getVideoMode() const {
|
||||
return sf::VideoMode(BASE_WINDOW_SIZE * (unsigned int) WINDOW_SIZE_MULTIPLIERS[this->windowSizeMode]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user