From 6bb3ee96671aaf67ceaaf8847b723aea2f0e6064 Mon Sep 17 00:00:00 2001 From: mduval76 <9343789@etu.cegepsth.qc.ca> Date: Thu, 16 Nov 2023 20:47:20 -0500 Subject: [PATCH] push changement de location --- SQCSim-common/SQCSim-common.vcxproj | 2 + SQCSim-common/SQCSim-common.vcxproj.filters | 6 ++ SQCSim-common/parameters.cpp | 67 +++++++++++++++++++++ SQCSim-common/parameters.h | 55 +++++++++++++++++ SQCSim2021/define.h | 1 - SQCSim2021/engine.h | 3 - SQCSim2021/parameters.cpp | 1 - SQCSim2021/parameters.h | 8 --- 8 files changed, 130 insertions(+), 13 deletions(-) create mode 100644 SQCSim-common/parameters.cpp create mode 100644 SQCSim-common/parameters.h delete mode 100644 SQCSim2021/parameters.cpp delete mode 100644 SQCSim2021/parameters.h diff --git a/SQCSim-common/SQCSim-common.vcxproj b/SQCSim-common/SQCSim-common.vcxproj index 4cebfaf..a2259e3 100644 --- a/SQCSim-common/SQCSim-common.vcxproj +++ b/SQCSim-common/SQCSim-common.vcxproj @@ -139,6 +139,7 @@ + @@ -151,6 +152,7 @@ + diff --git a/SQCSim-common/SQCSim-common.vcxproj.filters b/SQCSim-common/SQCSim-common.vcxproj.filters index 26c6c05..9f3461d 100644 --- a/SQCSim-common/SQCSim-common.vcxproj.filters +++ b/SQCSim-common/SQCSim-common.vcxproj.filters @@ -54,6 +54,9 @@ Fichiers d%27en-tĂȘte + + Fichiers d%27en-tĂȘte + @@ -80,5 +83,8 @@ Fichiers sources + + Fichiers sources + \ No newline at end of file diff --git a/SQCSim-common/parameters.cpp b/SQCSim-common/parameters.cpp new file mode 100644 index 0000000..4fd9ff1 --- /dev/null +++ b/SQCSim-common/parameters.cpp @@ -0,0 +1,67 @@ +#include "parameters.h" + +Parameters::Parameters() {} + +Parameters::~Parameters() {} + +void Parameters::SaveAudioParameters() { + +} + +void Parameters::SaveGraphicParameters() { + +} + +void Parameters::SaveGameParameters() { + +} + +void Parameters::LoadAudioParameters() { + +} + +void Parameters::LoadGraphicParameters() { + +} + +void Parameters::LoadGameParameters() { + +} + +void Parameters::SetAudioParameter(const std::string& key, const ParameterValue& value) { + m_audioSettings[key] = value; +} + +void Parameters::SetGraphicParameter(const std::string& key, const ParameterValue& value) { + m_graphicSettings[key] = value; +} + +void Parameters::SetGameParameter(const std::string& key, const ParameterValue& value) { + m_gameplaySettings[key] = value; +} + +std::optional Parameters::GetAudioParameter(const std::string& key) const { + auto it = m_audioSettings.find(key); + if (it != m_audioSettings.end()) { + return it->second; + } + return std::nullopt; +} + +std::optional Parameters::GetGraphicParameter(const std::string& key) const { + auto it = m_graphicSettings.find(key); + if (it != m_graphicSettings.end()) { + return it->second; + } + return std::nullopt; +} + +std::optional Parameters::GetGameParameter(const std::string& key) const { + auto it = m_gameplaySettings.find(key); + if (it != m_gameplaySettings.end()) { + return it->second; + } + return std::nullopt; +} + + diff --git a/SQCSim-common/parameters.h b/SQCSim-common/parameters.h new file mode 100644 index 0000000..3e2acea --- /dev/null +++ b/SQCSim-common/parameters.h @@ -0,0 +1,55 @@ +#ifndef PARAMETERS_H +#define PARAMETERS_H + +#include +#include +#include +#include +#include +#include +#include + +using ParameterValue = std::variant; + +class Parameters { +public: + Parameters(); + ~Parameters(); + + void SaveAudioParameters(); + void SaveGraphicParameters(); + void SaveGameParameters(); + + void LoadAudioParameters(); + void LoadGraphicParameters(); + void LoadGameParameters(); + + 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); + + std::optional GetAudioParameter(const std::string& key) const; + std::optional GetGraphicParameter(const std::string& key) const; + std::optional GetGameParameter(const std::string& key) const; + +private: + std::map m_audioSettings; + std::map m_graphicSettings; + std::map m_gameplaySettings; + + // Audio + float m_mainVolume; + float m_musicVolume; + float m_sfxVolume; + + // Graphic + float m_resolutionX; + float m_resolutionY; + bool m_fullscreen; + + // Gameplay + float m_mouseSensitivity; + +}; + +#endif // PARAMETERS_H \ No newline at end of file diff --git a/SQCSim2021/define.h b/SQCSim2021/define.h index 7f4c4af..4515ed8 100644 --- a/SQCSim2021/define.h +++ b/SQCSim2021/define.h @@ -28,7 +28,6 @@ #define BASE_WIDTH 640 #define BASE_HEIGHT 480 - #define TEXTURE_PATH "./media/textures/" #define SHADER_PATH "./media/shaders/" #define AUDIO_PATH "./media/audio/" diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 2ea8605..99dc6c5 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -101,13 +101,10 @@ private: Texture PauseBGTexture; Texture SplachScreenTexture; - float m_scale; float m_time = 0; float m_time_SplashScreen = 0; float m_titleX = 0; float m_titleY = 0; - float m_Width = 0; - float m_Height = 0; int m_renderCount = 0; int m_countdown = COUNTDOWN; diff --git a/SQCSim2021/parameters.cpp b/SQCSim2021/parameters.cpp deleted file mode 100644 index 5dd7956..0000000 --- a/SQCSim2021/parameters.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "parameters.h" diff --git a/SQCSim2021/parameters.h b/SQCSim2021/parameters.h deleted file mode 100644 index 51a477e..0000000 --- a/SQCSim2021/parameters.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef PARAMETERS_H -#define PARAMETERS_H - -class Parameters { - -}; - -#endif // PARAMETERS_H \ No newline at end of file