From 4c695fbe47b58965c3a34e1fc5dc11b188cd2220 Mon Sep 17 00:00:00 2001 From: Rynort Date: Mon, 13 Nov 2023 15:42:04 -0500 Subject: [PATCH 1/5] mini changement --- SQCSim2021/engine.cpp | 6 +++--- SQCSim2021/engine.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 76f379b..e979127 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -73,7 +73,7 @@ void Engine::DrawSplachScreen() glMatrixMode(GL_MODELVIEW); glPopMatrix(); - m_gamestate = GameState::OPTIONS; + m_gamestate = GameState::SINGLEMULTI; } @@ -1123,7 +1123,7 @@ void Engine::Render(float elapsedTime) { netprot::sendPackTo(m_conn.m_sock_udp, &input, &buf, &buflen, &m_conn.m_srvsockaddr); } } - else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS) + else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::SINGLEMULTI) { if (!m_soloMultiChoiceMade) { DisplaySingleOrMultiplayerMenu(); @@ -1326,7 +1326,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400)) m_gamestate = GameState::QUIT; } - else if (m_gamestate == GameState::OPTIONS) + else if (m_gamestate == GameState::SINGLEMULTI) { float buttonWidthProportion = 0.4f; float buttonHeightProportion = 0.075f; diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index d51d064..6aa4f89 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -90,7 +90,7 @@ private: std::map m_players; //Menu - enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY }; + enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY,SINGLEMULTI }; GameState m_gamestate = GameState::MAIN_MENU; Texture MenuTitleTexture; Texture MenuBGTexture; From 3ca941f0ce9724e6e0140b6593f2a8ebe37d4e36 Mon Sep 17 00:00:00 2001 From: Rynort Date: Mon, 13 Nov 2023 17:20:33 -0500 Subject: [PATCH 2/5] Update engine.cpp --- SQCSim2021/engine.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index e979127..e5d97d1 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -73,7 +73,7 @@ void Engine::DrawSplachScreen() glMatrixMode(GL_MODELVIEW); glPopMatrix(); - m_gamestate = GameState::SINGLEMULTI; + m_gamestate = GameState::MAIN_MENU; } @@ -1123,15 +1123,12 @@ void Engine::Render(float elapsedTime) { netprot::sendPackTo(m_conn.m_sock_udp, &input, &buf, &buflen, &m_conn.m_srvsockaddr); } } - else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::SINGLEMULTI) + else if (m_gamestate == GameState::MAIN_MENU) { - if (!m_soloMultiChoiceMade) { - DisplaySingleOrMultiplayerMenu(); - } - else { - DrawMenu(); - } + DrawMenu(); } + else if (m_gamestate == GameState::SINGLEMULTI) + DisplaySingleOrMultiplayerMenu(); else if (m_gamestate == GameState::QUIT) Stop(); } @@ -1322,7 +1319,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { else if (m_gamestate == GameState::MAIN_MENU) { if ((m_mousemx >= 285 && m_mousemx <= 490) && (m_mousemy >= 150 && m_mousemy <= 250)) - m_gamestate = GameState::PLAY; + m_gamestate = GameState::SINGLEMULTI; if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400)) m_gamestate = GameState::QUIT; } From 75a32270b594ba9af08a890ba9ca5bf77e37648d Mon Sep 17 00:00:00 2001 From: Rynort Date: Mon, 20 Nov 2023 15:45:08 -0500 Subject: [PATCH 3/5] mini-push --- SQCSim2021/engine.cpp | 18 +++++++++--------- SQCSim2021/engine.h | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index e5d97d1..2f872e7 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -156,7 +156,7 @@ void Engine::DrawMenu() glVertex2i(0, 200); glEnd();*/ - /*MenuOptionsTexture.Bind(); + MenuOptionsTexture.Bind(); glTranslated(0, -100, 0); glBegin(GL_QUADS); glTexCoord2f(0, 0); @@ -167,7 +167,7 @@ void Engine::DrawMenu() glVertex2i(sButton, 200); glTexCoord2f(0, 1); glVertex2i(0, 200); - glEnd();*/ + glEnd(); MenuQuitTexture.Bind(); glTranslated(0, -100, 0); @@ -185,7 +185,7 @@ void Engine::DrawMenu() } else { - /*MenuOptionsTexture.Bind(); + MenuOptionsTexture.Bind(); glTranslated(200, 0, 0); glBegin(GL_QUADS); glTexCoord2f(0, 0); @@ -198,7 +198,7 @@ void Engine::DrawMenu() glVertex2i(0, 200); glEnd(); - WireFrameTexture.Bind(); + /*WireFrameTexture.Bind(); glTranslated(0, 300, 0); glBegin(GL_QUADS); glTexCoord2f(0, 0); @@ -209,9 +209,9 @@ void Engine::DrawMenu() glVertex2i(sButton, 200); glTexCoord2f(0, 1); glVertex2i(0, 200); - glEnd(); + glEnd();*/ - OnOffBtnTexture.Bind(); + /*OnOffBtnTexture.Bind(); glTranslated(200, 0, 0); glBegin(GL_QUADS); glTexCoord2f(0, 0); @@ -223,7 +223,7 @@ void Engine::DrawMenu() glTexCoord2f(0, 1); glVertex2i(0, 200); glEnd(); - glTranslated(-400, -300, 0); + glTranslated(-400, -300, 0);*/ MusicTexture.Bind(); glTranslated(200, 200, 0); @@ -262,7 +262,7 @@ void Engine::DrawMenu() glVertex2i(sButton, 200); glTexCoord2f(0, 1); glVertex2i(0, 200); - glEnd();*/ + glEnd(); } //glEnable(GL_LIGHTING); @@ -1321,7 +1321,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { if ((m_mousemx >= 285 && m_mousemx <= 490) && (m_mousemy >= 150 && m_mousemy <= 250)) m_gamestate = GameState::SINGLEMULTI; if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400)) - m_gamestate = GameState::QUIT; + m_gamestate = GameState::OPTIONS; } else if (m_gamestate == GameState::SINGLEMULTI) { diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 6aa4f89..543daf3 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -98,6 +98,9 @@ private: Texture MenuQuitTexture; Texture MenuOptionsTexture; Texture SplachScreenTexture; + Texture MusicTexture; //TODO + Texture OnOffBtnTexture;//TODO + Texture BackBtnTexture;//TODO float m_scale; float m_time = 0; From 83e438583f1637f7eb131535dadcbc4c044244c0 Mon Sep 17 00:00:00 2001 From: Rynort Date: Mon, 20 Nov 2023 17:34:39 -0500 Subject: [PATCH 4/5] Avancement Page Option --- SQCSim2021/engine.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++ SQCSim2021/engine.h | 1 + 2 files changed, 51 insertions(+) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 2f872e7..375c361 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -275,6 +275,50 @@ void Engine::DrawMenu() ShowCursor(); } +void Engine::DrawOption() +{ + static const int sTitle = 400; + static const int sButton = 225; + + glDisable(GL_LIGHTING); + + + glDisable(GL_DEPTH_TEST); + glDisable(GL_STENCIL_TEST); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, Width(), 0, Height(), -1, 1); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + + MenuOptionsTexture.Bind(); + glLoadIdentity(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2i(0, 0); + glTexCoord2f(1, 0); + glVertex2i(Width(), 0); // + glTexCoord2f(1, 1); + glVertex2i(Width(), Height()); + glTexCoord2f(0, 1); + glVertex2i(0, Height()); + glEnd(); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendEquation(GL_FUNC_ADD); + glEnable(GL_BLEND); + + //glEnable(GL_LIGHTING); + glDisable(GL_BLEND); + glEnable(GL_DEPTH_TEST); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + ShowCursor(); +} + void Engine::Init() { @@ -1129,6 +1173,10 @@ void Engine::Render(float elapsedTime) { } else if (m_gamestate == GameState::SINGLEMULTI) DisplaySingleOrMultiplayerMenu(); + else if (m_gamestate == GameState::MAIN_MENU) + { + DrawOption(); + } else if (m_gamestate == GameState::QUIT) Stop(); } @@ -1322,6 +1370,8 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { m_gamestate = GameState::SINGLEMULTI; if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 300 && m_mousemy <= 400)) m_gamestate = GameState::OPTIONS; + if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 450 && m_mousemy <= 500)) + m_gamestate = GameState::QUIT; } else if (m_gamestate == GameState::SINGLEMULTI) { diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 543daf3..15afb4c 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -26,6 +26,7 @@ public: Engine(); virtual ~Engine(); virtual void DrawMenu(); + virtual void DrawOption(); virtual void DrawSplachScreen(); virtual void Init(); virtual void DeInit(); From 9bb8b1c9e5817d058721583d92908288f4fb4854 Mon Sep 17 00:00:00 2001 From: Rynort Date: Mon, 27 Nov 2023 02:57:22 -0500 Subject: [PATCH 5/5] Ajout de la page Option Pas de bouton encore --- SQCSim2021/engine.cpp | 5 +++-- SQCSim2021/engine.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 375c361..20caecf 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -292,7 +292,7 @@ void Engine::DrawOption() glMatrixMode(GL_MODELVIEW); glPushMatrix(); - MenuOptionsTexture.Bind(); + MenuBGTexture.Bind(); glLoadIdentity(); glBegin(GL_QUADS); glTexCoord2f(0, 0); @@ -434,6 +434,7 @@ void Engine::LoadResource() { LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png"); LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png"); + LoadTexture(MenuBGOptionTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png"); LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png"); LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png"); LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png"); @@ -1173,7 +1174,7 @@ void Engine::Render(float elapsedTime) { } else if (m_gamestate == GameState::SINGLEMULTI) DisplaySingleOrMultiplayerMenu(); - else if (m_gamestate == GameState::MAIN_MENU) + else if (m_gamestate == GameState::OPTIONS) { DrawOption(); } diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 15afb4c..389ea53 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -95,6 +95,7 @@ private: GameState m_gamestate = GameState::MAIN_MENU; Texture MenuTitleTexture; Texture MenuBGTexture; + Texture MenuBGOptionTexture; Texture MenuStartTexture; Texture MenuQuitTexture; Texture MenuOptionsTexture;