101 lines
2.3 KiB
C++
101 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "../Core/Menu.h"
|
|
#include "Keybinds.h"
|
|
#include "PiecesType.h"
|
|
|
|
#include <vector>
|
|
#include <optional>
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
static const int CURRENT_FILE_FORMAT_VERSION = 11;
|
|
|
|
static const int MAXIMUM_BOARD_WIDTH = 40;
|
|
static const int MAXIMUM_BOARD_HEIGHT = 40;
|
|
|
|
static const int RELEASE_PIECES_SIZE = 15;
|
|
static const int DEBUG_PIECES_SIZE = 10;
|
|
|
|
static const int MINIMUM_PIECES_SIZE = 4;
|
|
#ifdef NDEBUG
|
|
static const int MAXIMUM_PIECES_SIZE = RELEASE_PIECES_SIZE;
|
|
#else
|
|
static const int MAXIMUM_PIECES_SIZE = DEBUG_PIECES_SIZE;
|
|
#endif
|
|
|
|
static const std::pair<PiecesType, int> DEFAULT_SELECTION = {ALL_PIECES, MINIMUM_PIECES_SIZE};
|
|
|
|
|
|
class Settings {
|
|
private:
|
|
Menu menu;
|
|
int loadablePiecesSize;
|
|
bool loadedPieces;
|
|
std::vector<Keybinds> keybinds;
|
|
int chosenKeybinds;
|
|
int windowSizeMode;
|
|
int startTimerLength;
|
|
Gamemode gamemode;
|
|
std::vector<std::pair<PiecesType, int>> selectedPieces;
|
|
std::vector<int> distributions;
|
|
|
|
public:
|
|
Settings(bool loadPieces);
|
|
|
|
void loadPieces(int loadablePiecesSizeRequest);
|
|
|
|
void loadSettingsFromFile(bool loadPieces, std::optional<int> loadablePiecesSizeRequest);
|
|
|
|
void saveSettingsToFile() const;
|
|
|
|
bool selectNextKeybinds();
|
|
|
|
bool selectPreviousKeybinds();
|
|
|
|
bool canModifyCurrentKeybinds() const;
|
|
|
|
bool widenWindow();
|
|
|
|
bool shortenWindow();
|
|
|
|
void changeVideoMode(sf::RenderWindow& window) const;
|
|
|
|
bool lengthenStartTimer();
|
|
|
|
bool shortenStartTimer();
|
|
|
|
void setGamemode(Gamemode gamemode);
|
|
|
|
void selectPieces(PiecesType type, int value);
|
|
|
|
void unselectPieces(int index);
|
|
|
|
void confirmSelectedPieces();
|
|
|
|
bool increaseDistribution(int size);
|
|
|
|
bool decreaseDistribution(int size);
|
|
|
|
void confirmDistribution();
|
|
|
|
Menu& getMenu();
|
|
|
|
Keybinds& getKeybinds();
|
|
|
|
int getLoadablePiecesSize() const;
|
|
|
|
bool hasLoadedPieces() const;
|
|
|
|
int getKeybindsLayout() const;
|
|
|
|
Gamemode getGamemode() const;
|
|
|
|
int getWindowSizeMultiplier() const;
|
|
|
|
int getStartTimerLength() const;
|
|
|
|
const std::vector<std::pair<PiecesType, int>>& getSelectedPieces() const;
|
|
|
|
const std::vector<int>& getDistributions() const;
|
|
};
|