Files
jminos/src/GraphicalUI/Settings.h
2025-03-31 19:22:52 +02:00

102 lines
2.2 KiB
C++

#pragma once
#include "../Core/Menu.h"
#include "Keybinds.h"
#include "PiecesType.h"
#include <vector>
#include <SFML/Graphics.hpp>
static const int CURRENT_FILE_FORMAT_VERSION = 10;
static const int MAXIMUM_BOARD_WIDTH = 40;
static const int MAXIMUM_BOARD_HEIGHT = 40;
static const int MINIMUM_PIECES_SIZE = 4;
static const int MAXIMUM_PIECES_SIZE = 15;
//#define __JMINOS_RELEASE__
#ifdef __JMINOS_RELEASE__
static const int LOADED_PIECES_SIZE = 15;
#else
static const int LOADED_PIECES_SIZE = 10;
#endif
static const std::pair<PiecesType, int> DEFAULT_SELECTION = {ALL_PIECES, MINIMUM_PIECES_SIZE};
class Settings {
private:
Menu menu;
int maximumPiecesSize;
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);
private:
bool loadPieces(int maximumPiecesSizeRequest);
public:
void loadSettingsFromFile(bool loadPieces = true);
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 getMaximumPiecesSize() 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;
};