Push premiere esquisse des parametres de sauvegarde

This commit is contained in:
mduval76
2023-11-16 23:39:44 -05:00
parent 6bb3ee9667
commit 8e041a314d
5 changed files with 163 additions and 74 deletions

View File

@@ -1,55 +1,66 @@
#ifndef PARAMETERS_H
#define PARAMETERS_H
#include <optional>
#include <iostream>
#include <fstream>
#include <sstream>
#include <variant>
#include <string>
#include <map>
using ParameterValue = std::variant<float, int, bool, std::string>;
#include "define.h"
class Parameters {
public:
Parameters();
~Parameters();
void SaveAudioParameters();
void SaveGraphicParameters();
void SaveGameParameters();
void SaveFile(const std::string& filename);
void LoadFile(const std::string& filename);
void LoadAudioParameters();
void LoadGraphicParameters();
void LoadGameParameters();
// Audio
float GetMainVolume() const;
void SetMainVolume(float volume);
void SetAudioParameter(const std::string& key, const ParameterValue& value);
void SetGraphicParameter(const std::string& key, const ParameterValue& value);
void SetGameParameter(const std::string& key, const ParameterValue& value);
float GetMusicVolume() const;
void SetMusicVolume(float volume);
std::optional<ParameterValue> GetAudioParameter(const std::string& key) const;
std::optional<ParameterValue> GetGraphicParameter(const std::string& key) const;
std::optional<ParameterValue> GetGameParameter(const std::string& key) const;
float GetSfxVolume() const;
void SetSfxVolume(float volume);
// Graphic
float GetBrightness() const;
void SetBrightness(float brightness);
float GetContrast() const;
void SetContrast(float contrast);
bool GetFullscreen() const;
void SetFullscreen(bool fullscreen);
const Resolution& GetResolution() const;
void SetResolution(const Resolution& resolution);
// Gameplay
float GetMouseSensitivity() const;
void SetMouseSensitivity(float sensitivity);
void ApplyResolution(Resolution resolution);
private:
std::map<std::string, ParameterValue> m_audioSettings;
std::map<std::string, ParameterValue> m_graphicSettings;
std::map<std::string, ParameterValue> m_gameplaySettings;
// Audio
float m_mainVolume;
float m_musicVolume;
float m_sfxVolume;
// Graphic
float m_resolutionX;
float m_resolutionY;
Resolution m_resolution;
bool m_fullscreen;
int m_rezWidth;
int m_rezHeight;
float m_brightness;
float m_contrast;
// Gameplay
float m_mouseSensitivity;
};
#endif // PARAMETERS_H