Compare commits

..

90 Commits

Author SHA1 Message Date
MarcEricMartel
754130ec39 Merge pull request #36 from CegepSTH/revert-35-SQC-15_paquets
Revert "IGNORE THIS"
2023-12-04 13:16:03 -05:00
MarcEricMartel
8569e17c93 Revert "IGNORE THIS" 2023-12-04 13:14:54 -05:00
MarcEricMartel
c5700ae9fd Merge pull request #35 from CegepSTH/SQC-15_paquets
IGNORE THIS
2023-12-04 13:14:33 -05:00
MarcEricMartel
78b3ed85cb Merge branch 'MenusMenusMenus' into SQC-15_paquets 2023-12-04 13:13:54 -05:00
mduval76
4b6c641c97 Push replacer Render 2023-12-04 13:02:28 -05:00
MarcEricMartel
9ed8ef3273 Moar random? 2023-12-03 11:14:08 -05:00
mduval76
8b448f5072 Push pre-gamestate Pause 2023-12-03 00:47:04 -05:00
mduval76
a67499049b Push gros paquets de menus. Nouvelle hierarchie Clean up de larborescence des textures pour elements des menus. 2023-12-03 00:15:18 -05:00
MarcEricMartel
0af76b3f2e Merge pull request #33 from CegepSTH/SQC32_sauveParams
Sqc32 sauve params
2023-12-02 15:09:14 -05:00
MarcEricMartel
b2c73c930e Merge pull request #32 from CegepSTH/SQC-35_nouvelles_structures
Sqc 35 nouvelles structures
2023-12-02 14:59:21 -05:00
MarcEricMartel
4aa0aedd61 Update connector.cpp 2023-12-02 14:52:25 -05:00
MarcEricMartel
e52dbd3705 Merge branch 'master' into SQC-15_paquets 2023-12-02 14:05:41 -05:00
MarcEricMartel
5a491c5446 omg 💣 2023-12-02 11:05:00 -05:00
MarcEricMartel
20eb410b08 Hahaha il manquait les ChunkMods dans netprot :finnadie: 2023-12-02 10:04:18 -05:00
MarcEricMartel
c44d1453ae Oh wow 2023-12-02 09:23:26 -05:00
MarcEricMartel
37ea09aaf3 Merge branch 'SQC-15_paquets' of https://github.com/CegepSTH/SQCSim2023 into SQC-15_paquets 2023-12-02 09:06:54 -05:00
MarcEricMartel
62b7719eb4 Erratas! 2023-12-02 09:06:41 -05:00
mduval76
3842ca3485 Push bouton pour retourner au menu principal. Makeover des anciens boutons. 2023-12-01 20:26:52 -05:00
mduval76
98390c878f Push pourcentage dynamique pour sliders menu options 2023-12-01 19:20:55 -05:00
mduval76
def1ab284e Push sliders fonctionnels (x4) 2023-12-01 17:55:25 -05:00
mduval76
90e736a14c push ajouts des barres pour "sliders" 2023-12-01 15:46:08 -05:00
mduval76
ac3628ec0b Push zones cliquables sliders et checks 2023-12-01 14:37:12 -05:00
mduval76
3e3a7650e8 Push options Volume et Resolution de base 2023-12-01 13:48:48 -05:00
mduval76
28082a018d Push menu options de base 2023-12-01 09:49:00 -05:00
Marc-Eric Martel
681ac61a74 ajouts dans les cmakelists pour leenuqs 2023-11-29 19:02:16 -05:00
Marc-Eric Martel
38cfa95297 ajouts dans les cmakelists pour leenuqs 2023-11-29 18:59:58 -05:00
Marc-Eric Martel
34ad4724f2 Tibug + Linux 2023-11-28 19:19:24 -05:00
MarcEricMartel
12ef911e79 Delete the world... delete the children... 2023-11-28 11:53:21 -05:00
MarcEricMartel
5c346c48e6 🏥 2023-11-28 11:38:38 -05:00
MarcEricMartel
e89b5914fb Sync ees almöss de voork! 2023-11-27 17:44:52 -05:00
mduval76
15882dc506 Merge branch 'master' into SQC32_sauveParams 2023-11-27 17:14:53 -05:00
mduval76
6db90a3a16 Push reajustements apres merge 31 2023-11-27 17:07:51 -05:00
mduval76
b23b2c6838 Merge pull request #31 from CegepSTH/SQC-31
Sqc 31 smerge
2023-11-27 16:55:31 -05:00
mduval76
a26929fe66 Merge branch 'master' into SQC-31 2023-11-27 16:54:58 -05:00
MarcEricMartel
10b8d77734 ehm 2023-11-27 16:43:18 -05:00
MarcEricMartel
e8ca08ecab Superman + Alfred 2023-11-27 16:12:12 -05:00
mduval76
4a9ad70d48 Push changement pour Parametres -> Settings 2023-11-27 16:03:06 -05:00
MarcEricMartel
cfc7f7e01d Ça s'ra pas long. 2023-11-27 15:15:21 -05:00
MarcEricMartel
0b5c30b693 123457 💯 2023-11-27 15:03:53 -05:00
MarcEricMartel
f9c3571ab2 1080p 2023-11-27 14:56:43 -05:00
MarcEricMartel
2a7fe7e806 LA CLAN PANNETON POUR DÉMÉNAGER FAUT SIGNALER LE (/&)&)&! 2023-11-27 14:53:23 -05:00
MarcEricMartel
8ea5af6ef9 16 tons. 2023-11-27 14:48:18 -05:00
MarcEricMartel
841b0176f6 HAHAHAHA HEY! MOSKAU MOSKAU BADDABADBADBABDBAD 2023-11-27 14:42:56 -05:00
MarcEricMartel
702a65c5b0 EEEEEEEH BO DEREK, EH 2023-11-27 14:24:11 -05:00
MarcEricMartel
b6d5975648 I know what boys like. 2023-11-27 13:52:49 -05:00
MarcEricMartel
6e556b4f84 IDBENOGOOD 2023-11-27 13:29:59 -05:00
MarcEricMartel
e6b3f2fb1c UDP to the rescue 2023-11-27 13:21:50 -05:00
MarcEricMartel
5e57a13820 Fuck around and find out 2023-11-27 13:15:39 -05:00
MarcEricMartel
9a7d25c1d9 EH LALA. 2023-11-27 13:11:24 -05:00
MarcEricMartel
c24123362a ah. 2023-11-27 12:42:46 -05:00
MarcEricMartel
6c0d65ea22 Info. 2023-11-27 12:39:36 -05:00
Rynort
9bb8b1c9e5 Ajout de la page Option
Pas de bouton encore
2023-11-27 02:57:22 -05:00
MarcEricMartel
35a5ddd9bd static_cast? 2023-11-26 12:40:08 -05:00
MarcEricMartel
85ab712032 Summary (required) 2023-11-26 12:31:17 -05:00
MarcEricMartel
0f1a864282 🎶 If you want to destroy my renderrrrrrrrrr... 2023-11-26 12:23:17 -05:00
MarcEricMartel
0200f77be8 Johnny B. NoGood! 🎶 2023-11-26 12:19:05 -05:00
MarcEricMartel
935216e9c3 Ça plane pour pasmoi. 2023-11-26 12:12:09 -05:00
mduval76
1ab83a85a7 Transfert classe Paramteres de common à SQCSim 2021 2023-11-25 14:05:47 -05:00
mduval76
2ab201e93c Validation changements indexes. Fusion main vers sauveparams 2023-11-25 13:59:51 -05:00
MarcEricMartel
ea3d2ffc34 2023-11-24 15:56:58 -05:00
MarcEricMartel
775c8cf26f 440hz 2023-11-24 15:32:53 -05:00
MarcEricMartel
0c1714dd14 INXS 2023-11-24 15:25:40 -05:00
MarcEricMartel
981d66c730 M*SYNCs 2023-11-24 15:24:46 -05:00
MarcEricMartel
bd3f677118 PATATE PLAY 2023-11-24 15:11:16 -05:00
MarcEricMartel
35c55f2e26 -__- 2023-11-24 15:01:32 -05:00
MarcEricMartel
9bf5188e0f 5 2023-11-24 14:54:38 -05:00
MarcEricMartel
e8d456cc09 -danse de la pluie- 2023-11-24 14:36:55 -05:00
MarcEricMartel
3043b1ff6b débébitter 2023-11-24 14:33:48 -05:00
MarcEricMartel
7ccecdfd4a if notaire break. 2023-11-24 14:27:11 -05:00
MarcEricMartel
6f13e8fb70 🔡 2023-11-24 14:22:05 -05:00
MarcEricMartel
d1c3d17055 ayoye bobo 2023-11-24 14:18:37 -05:00
MarcEricMartel
573316682b Jim Babwe 2023-11-24 14:15:40 -05:00
MarcEricMartel
bd14cd3962 Cleanup II 2023-11-24 13:47:47 -05:00
MarcEricMartel
480521ebaf Cleanup 2023-11-24 13:47:24 -05:00
MarcEricMartel
312542857a united states of remoteplayer 2023-11-24 13:46:16 -05:00
MarcEricMartel
c1aa321f2b 💩 2023-11-24 13:42:53 -05:00
MarcEricMartel
d7bd36d134 DE 🐛 2023-11-24 13:05:17 -05:00
MarcEricMartel
ce2d03c354 Render other players 2023-11-24 12:58:06 -05:00
MarcEricMartel
2e30995f1b Merge branch 'SQC-15_animation' into SQC-15_paquets 2023-11-24 12:46:04 -05:00
Claudel-D-Roy
9572a7d6fd push des textures Atlas des animations 2023-11-24 12:45:17 -05:00
MarcEricMartel
f22c405915 Erratum. 2023-11-24 12:43:09 -05:00
MarcEricMartel
bc7127ef7d Eh baswell 2023-11-24 12:41:20 -05:00
MarcEricMartel
06a5bb67d3 :clock: côté client 2023-11-24 12:36:01 -05:00
Rynort
83e438583f Avancement Page Option 2023-11-20 17:34:39 -05:00
Rynort
75a32270b5 mini-push 2023-11-20 15:45:08 -05:00
mduval76
8e041a314d Push premiere esquisse des parametres de sauvegarde 2023-11-16 23:39:44 -05:00
mduval76
6bb3ee9667 push changement de location 2023-11-16 20:47:20 -05:00
mduval76
f654c5effa Push initial pour sauvegarde des paramètres 2023-11-16 18:01:00 -05:00
Rynort
3ca941f0ce Update engine.cpp 2023-11-13 17:20:33 -05:00
Rynort
4c695fbe47 mini changement 2023-11-13 15:42:04 -05:00
42 changed files with 1197 additions and 639 deletions

View File

@@ -49,6 +49,7 @@ typedef uint64_t Timestamp;
#pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject #pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject
#pragma comment(lib,"ws2_32.lib") #pragma comment(lib,"ws2_32.lib")
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <Windows.h> #include <Windows.h>
#include <cstdio> #include <cstdio>

View File

@@ -27,6 +27,7 @@
<ClInclude Include="mesh.h" /> <ClInclude Include="mesh.h" />
<ClInclude Include="openglcontext.h" /> <ClInclude Include="openglcontext.h" />
<ClInclude Include="remoteplayer.h" /> <ClInclude Include="remoteplayer.h" />
<ClInclude Include="settings.h" />
<ClInclude Include="shader.h" /> <ClInclude Include="shader.h" />
<ClInclude Include="skybox.h" /> <ClInclude Include="skybox.h" />
<ClInclude Include="texture.h" /> <ClInclude Include="texture.h" />
@@ -44,6 +45,7 @@
<ClCompile Include="mesh.cpp" /> <ClCompile Include="mesh.cpp" />
<ClCompile Include="openglcontext.cpp" /> <ClCompile Include="openglcontext.cpp" />
<ClCompile Include="remoteplayer.cpp" /> <ClCompile Include="remoteplayer.cpp" />
<ClCompile Include="settings.cpp" />
<ClCompile Include="shader.cpp" /> <ClCompile Include="shader.cpp" />
<ClCompile Include="skybox.cpp" /> <ClCompile Include="skybox.cpp" />
<ClCompile Include="texture.cpp" /> <ClCompile Include="texture.cpp" />

View File

@@ -56,6 +56,9 @@
<ClInclude Include="booster.h"> <ClInclude Include="booster.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="settings.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="engine.cpp"> <ClCompile Include="engine.cpp">
@@ -103,5 +106,8 @@
<ClCompile Include="booster.cpp"> <ClCompile Include="booster.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="settings.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -48,3 +48,7 @@ void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& v
void Audio::ToggleMusicState() { m_music->setIsPaused(!m_music->getIsPaused()); } void Audio::ToggleMusicState() { m_music->setIsPaused(!m_music->getIsPaused()); }
void Audio::PauseEngine() { m_engine->setAllSoundsPaused(); } void Audio::PauseEngine() { m_engine->setAllSoundsPaused(); }
float Audio::GetMusicVolume() const {
return m_music->getVolume();
}

View File

@@ -33,6 +33,8 @@ public:
void ToggleMusicState(); void ToggleMusicState();
void PauseEngine(); void PauseEngine();
float GetMusicVolume() const;
}; };
#endif // AUDIO_H__ #endif // AUDIO_H__

View File

@@ -34,7 +34,22 @@
#define SHADER_PATH "./media/shaders/" #define SHADER_PATH "./media/shaders/"
#define AUDIO_PATH "./media/audio/" #define AUDIO_PATH "./media/audio/"
#define CHUNK_PATH "./media/chunks/" #define CHUNK_PATH "./media/chunks/"
#define MENU_ITEM_PATH "./media/menu_items/"
#define BOOSTER_TEXTURE_PATH "./media/textures/Booster/" #define BOOSTER_TEXTURE_PATH "./media/textures/Booster/"
enum GameState {
MAIN_MENU,
SPLASH,
OPTIONS,
QUIT,
PLAY,
PAUSE
};
enum Resolution {
HD = 0, // 1280x720 (High Definition)
FHD, // 1920x1080 (Full HD)
QHD, // 2560x1440 (Quad HD)
UHD // 3840x2160 (Ultra HD)
};
#endif // DEFINE_H__ #endif // DEFINE_H__

File diff suppressed because it is too large Load Diff

View File

@@ -24,15 +24,12 @@
#include "renderer.h" #include "renderer.h"
#include "remoteplayer.h" #include "remoteplayer.h"
#include "booster.h" #include "booster.h"
#include "settings.h"
class Engine : public OpenglContext { class Engine : public OpenglContext {
public: public:
Engine(); Engine();
virtual ~Engine(); virtual ~Engine();
virtual void DrawMenu();
virtual void DrawPause();
virtual void DrawSplachScreen();
virtual void Init(); virtual void Init();
virtual void DeInit(); virtual void DeInit();
virtual void LoadResource(); virtual void LoadResource();
@@ -47,90 +44,142 @@ public:
private: private:
int GetFps(float elapsedTime) const; int GetFps(float elapsedTime) const;
int GetCountdown(float elapsedTime); int GetCountdown(float elapsedTime);
int GetOptionsChoice();
bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true); bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true);
void InstantDamage(); void InstantDamage();
void SystemNotification(std::string systemLog); void SystemNotification(std::string systemLog);
void KillNotification(Player killer, Player killed); void KillNotification(Player killer, Player killed);
void DisplayNotification(std::string message); void DisplayNotification(std::string message);
void ProcessNotificationQueue();
void DisplayCrosshair(); void DisplayCrosshair();
void DisplayPovGun(); void DisplayPovGun();
void DisplayCurrentItem(); void DisplayCurrentItem();
void DisplayHud(int timer); void DisplayHud(int timer);
void DisplayInfo(float elapsedTime, BlockType bloc);
void DisplaySingleOrMultiplayerMenu();
void DrawHud(float elapsedTime, BlockType bloc); void DrawHud(float elapsedTime, BlockType bloc);
void DisplayInfo(float elapsedTime, BlockType bloc);
void DisplaySplashScreen();
void DisplayPauseMenu();
void DisplayMainMenu();
void DrawButtonBackgrounds(float centerX, float centerY, int iterations);
void DrawMainMenuButtons(float centerX, float centerY);
void DrawSingleMultiButtons(float centerX, float centerY);
void DisplayOptionsMenu();
void DisplayAudioMenu(float centerX, float centerY);
void DisplayGraphicsMenu(float centerX, float centerY);
void DisplayGameplayMenu(float centerX, float centerY);
void DrawSliderBackground(float centerX, float centerY, float minVal, float maxVal, float bottomSideValue, float topSideValue);
void DisplayBarPercentValue(float centerX, float centerY, float posX, float posY, float minVal, float maxVal, float value);
void DrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue);
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f); void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
void ProcessNotificationQueue();
Connector m_conn; Connector m_conn;
Shader m_shader01;
Audio m_audio = Audio(AUDIO_PATH "start.wav");
irrklang::ISound* m_powpow, * m_scream;
irrklang::ISound* m_whoosh[MAX_BULLETS];
Bullet* m_bullets[MAX_BULLETS];
std::chrono::high_resolution_clock::time_point m_startTime;
std::unordered_map<uint64_t, Player*> m_players;
netprot::Buffer m_buf, m_bufout;
netprot::PlayerInfo m_pinfo;
RemotePlayer m_remotePlayer = RemotePlayer(netprot::PlayerInfo(), Vector3f(5.5f, CHUNK_SIZE_Y + 1.8f, 5.5f));
std::string m_messageNotification = "";
World m_world = World();
Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f));
Renderer m_renderer = Renderer();
Booster m_booster = Booster();
BlockInfo* m_blockinfo[BTYPE_LAST]; BlockInfo* m_blockinfo[BTYPE_LAST];
BoostInfo* m_boostinfo[BTYPE_BOOST_LAST]; BoostInfo* m_boostinfo[BTYPE_BOOST_LAST];
GameState m_gamestate = GameState::SPLASH;
Shader m_shader01;
Skybox m_skybox;
TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST); TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST);
TextureAtlas m_animeAtlas = TextureAtlas(TYPE_LAST + POS_LAST); TextureAtlas m_animeAtlas = TextureAtlas(TYPE_LAST + POS_LAST);
World m_world = World(); TextureAtlas::TextureIndex texBoostHeal;
Renderer m_renderer = Renderer();
Booster m_booster = Booster();
Texture m_textureCrosshair; Texture m_textureCrosshair;
Texture m_textureFont; Texture m_textureFont;
Texture m_textureGun; Texture m_textureGun;
Texture m_texturePovGun; Texture m_texturePovGun;
Texture m_textureSkybox; Texture m_textureSkybox;
Texture m_textureSoloMultiMenu;
Texture m_textureSoloText;
Texture m_textureMultiText;
Texture m_textureTitle;
TextureAtlas::TextureIndex texBoostHeal; Texture m_textureMainMenu;
Texture m_textureOptionsMenu;
Texture m_texturePauseMenu;
Texture m_textureSplashScreen;
Skybox m_skybox; Texture m_textureHd;
Audio m_audio = Audio(AUDIO_PATH "start.wav"); Texture m_textureFhd;
Texture m_textureQhd;
Texture m_textureUhd;
Texture m_textureCheck;
Texture m_textureChecked;
irrklang::ISound* m_powpow, Texture m_textureOptAudio;
* m_scream; Texture m_textureOptBack;
irrklang::ISound *m_whoosh[MAX_BULLETS]; Texture m_textureOptGameplay;
Texture m_textureOptGraphics;
Texture m_textureOptMain;
Texture m_textureOptMusic;
Texture m_textureOptOptions;
Texture m_textureOptResolution;
Texture m_textureOptSensitivity;
Texture m_textureOptSfx;
Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); Texture m_textureMenuBack;
Texture m_textureMenuMulti;
Bullet* m_bullets[MAX_BULLETS]; Texture m_textureMenuOptions;
Texture m_textureMenuPlay;
Texture m_textureMenuQuit;
Texture m_textureMenuSingle;
Texture m_textureMenuTitle;
std::unordered_map<uint64_t, Player*> m_players; Settings m_options = Settings(m_audio);
netprot::Buffer m_buf, m_bufout;
std::chrono::high_resolution_clock::time_point m_startTime;
//Menu
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
GameState m_gamestate = GameState::MAIN_MENU;
Texture MenuTitleTexture;
Texture MenuBGTexture;
Texture MenuStartTexture;
Texture MenuQuitTexture;
Texture MenuOptionsTexture;
Texture PauseBGTexture;
Texture SplachScreenTexture;
Resolution m_resolution = HD;
float m_splashTime = 2.0f;
float m_scale; float m_scale;
float m_time = 0; float m_time = 0;
float m_time_SplashScreen = 0;
float m_titleX = 0; float m_titleX = 0;
float m_titleY = 0; float m_titleY = 0;
float m_Width = 0;
float m_Height = 0;
int m_renderCount = 0; int m_renderCount = 0;
int m_countdown = COUNTDOWN; int m_countdown = COUNTDOWN;
int m_nbReductionChunk = 4; int m_nbReductionChunk = 4;
int m_timerReductionChunk = 30; int m_timerReductionChunk = 30;
float m_volPrincipal = 0.0f;
float m_volMusique = 0.0f;
float m_volEffets = 0.0f;
float m_volSensible = 0.0f;
int m_selectedOption = 0;
bool m_selectedOptAudioMainBar = false;
bool m_selectedOptAudioMusicBar = false;
bool m_selectedOptAudioSfxBar = false;
bool m_selectedGameplaySensitivityBar = false;
bool m_damage = false; bool m_damage = false;
bool m_wireframe = false; bool m_wireframe = false;
@@ -143,10 +192,13 @@ private:
bool m_resetcountdown = false; bool m_resetcountdown = false;
bool m_soloMultiChoiceMade = false; bool m_soloMultiChoiceMade = false;
bool m_stopcountdown = false; bool m_stopcountdown = false;
bool m_selectedPlayOptions = false;
bool m_selectedOptions = false;
bool m_selectedQuit = false;
bool m_key1 = false; bool m_key1 = false;
bool m_key2 = false; bool m_key2 = false;
bool m_keyK = false; bool m_keyK = false;
bool m_keyL = false; bool m_keyL = false;
bool m_keyW = false; bool m_keyW = false;
@@ -154,19 +206,17 @@ private:
bool m_keyS = false; bool m_keyS = false;
bool m_keyD = false; bool m_keyD = false;
bool m_keySpace = false; bool m_keySpace = false;
bool m_mouseL = false; bool m_mouseL = false;
bool m_mouseR = false; bool m_mouseR = false;
bool m_mouseC = false; bool m_mouseC = false;
bool m_mouseWU = false; bool m_mouseWU = false;
bool m_mouseWD = false; bool m_mouseWD = false;
//Pour trouver ou est la souris
float m_mousemx = 0; float m_mousemx = 0;
float m_mousemy = 0; float m_mousemy = 0;
bool m_networkgame = false; bool m_networkgame = false;
netprot::PlayerInfo m_pinfo;
RemotePlayer m_remotePlayer = RemotePlayer(netprot::PlayerInfo(),Vector3f(5.5f, CHUNK_SIZE_Y + 1.8f, 5.5f));
std::string m_messageNotification = "";
}; };
#endif // ENGINE_H__ #endif // ENGINE_H__

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 MiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

View File

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

146
SQCSim2021/settings.cpp Normal file
View File

@@ -0,0 +1,146 @@
#include "settings.h"
Settings::Settings(Audio& audio)
: m_audio(audio),
m_mainVolume(0.5f),
m_musicVolume(0.5f),
m_sfxVolume(0.5f),
m_resolution(FHD),
m_fullscreen(false),
m_brightness(0.5f),
m_contrast(0.5f),
m_mouseSensitivity(0.5f) {
ApplyResolution(m_resolution);
}
void Settings::SaveFile(const std::string& filename) {
std::ofstream file(filename);
if (!file.is_open()) {
std::cerr << "Failed to open file for saving parameters" << std::endl;
return;
}
file << m_mainVolume << '\n';
file << m_musicVolume << '\n';
file << m_sfxVolume << '\n';
file << static_cast<int>(m_resolution) << '\n';
file << m_fullscreen << '\n';
file << m_brightness << '\n';
file << m_contrast << '\n';
file << m_mouseSensitivity << '\n';
file.close();
}
void Settings::LoadFile(const std::string& filename) {
std::ifstream file(filename);
if (!file.is_open()) {
std::cerr << "Failed to open file for loading parameters" << std::endl;
return;
}
file >> m_mainVolume;
file >> m_musicVolume;
file >> m_sfxVolume;
int resolutionValue;
file >> resolutionValue;
m_resolution = static_cast<Resolution>(resolutionValue);
file >> m_fullscreen;
file >> m_brightness;
file >> m_contrast;
file >> m_mouseSensitivity;
file.close();
}
float Settings::GetMainVolume() const {
return m_mainVolume;
}
void Settings::SetMainVolume(float volume) {
m_mainVolume = volume;
}
void Settings::GetMusicVolume() {
m_musicVolume = m_audio.GetMusicVolume();
}
void Settings::SetMusicVolume(float volume) {
m_musicVolume = volume;
}
float Settings::GetSfxVolume() const {
return m_sfxVolume;
}
void Settings::SetSfxVolume(float volume) {
m_sfxVolume = volume;
}
float Settings::GetBrightness() const {
return m_brightness;
}
void Settings::SetBrightness(float brightness) {
m_brightness = brightness;
}
float Settings::GetContrast() const {
return m_contrast;
}
void Settings::SetContrast(float contrast) {
m_contrast = contrast;
}
bool Settings::GetFullscreen() const {
return m_fullscreen;
}
void Settings::SetFullscreen(bool fullscreen) {
m_fullscreen = fullscreen;
}
const Resolution& Settings::GetResolution() const {
return m_resolution;
}
void Settings::SetResolution(const Resolution& resolution) {
m_resolution = resolution;
}
float Settings::GetMouseSensitivity() const {
return m_mouseSensitivity;
}
void Settings::SetMouseSensitivity(float sensitivity) {
m_mouseSensitivity = sensitivity;
}
void Settings::ApplyResolution(Resolution resolution) {
switch (resolution) {
case HD:
m_rezWidth = 1280;
m_rezHeight = 720;
break;
case FHD:
m_rezWidth = 1920;
m_rezHeight = 1080;
break;
case QHD:
m_rezWidth = 2560;
m_rezHeight = 1440;
break;
case UHD:
m_rezWidth = 3840;
m_rezHeight = 2160;
break;
default:
break;
}
}

70
SQCSim2021/settings.h Normal file
View File

@@ -0,0 +1,70 @@
#ifndef SETTINGS_H__
#define SETTINGS_H__
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <map>
#include "define.h"
#include "audio.h"
class Settings {
public:
Settings(Audio& audio);
void SaveFile(const std::string& filename);
void LoadFile(const std::string& filename);
// Audio
float GetMainVolume() const;
void SetMainVolume(float volume);
void GetMusicVolume();
void SetMusicVolume(float volume);
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:
Audio& m_audio;
// Audio
float m_mainVolume;
float m_musicVolume;
float m_sfxVolume;
// Graphic
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