Merge branch 'master' into SQC-15_paquets

This commit is contained in:
MarcEricMartel 2023-12-02 14:05:41 -05:00
commit e52dbd3705
2 changed files with 39 additions and 28 deletions

View File

@ -76,7 +76,7 @@ void Engine::DrawSplachScreen()
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
m_gamestate = GameState::OPTIONS;
m_gamestate = GameState::MAIN_MENU;
}
@ -159,7 +159,7 @@ void Engine::DrawMenu()
glVertex2i(0, 200);
glEnd();*/
/*MenuOptionsTexture.Bind();
MenuOptionsTexture.Bind();
glTranslated(0, -100, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
@ -170,7 +170,7 @@ void Engine::DrawMenu()
glVertex2i(sButton, 200);
glTexCoord2f(0, 1);
glVertex2i(0, 200);
glEnd();*/
glEnd();
MenuQuitTexture.Bind();
glTranslated(0, -100, 0);
@ -188,7 +188,7 @@ void Engine::DrawMenu()
}
else
{
/*MenuOptionsTexture.Bind();
MenuOptionsTexture.Bind();
glTranslated(200, 0, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
@ -201,7 +201,7 @@ void Engine::DrawMenu()
glVertex2i(0, 200);
glEnd();
WireFrameTexture.Bind();
/*WireFrameTexture.Bind();
glTranslated(0, 300, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
@ -212,9 +212,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);
@ -226,7 +226,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);
@ -265,7 +265,7 @@ void Engine::DrawMenu()
glVertex2i(sButton, 200);
glTexCoord2f(0, 1);
glVertex2i(0, 200);
glEnd();*/
glEnd();
}
//glEnable(GL_LIGHTING);
@ -278,7 +278,7 @@ void Engine::DrawMenu()
ShowCursor();
}
void Engine::DrawPause()
void Engine::DrawOption()
{
static const int sTitle = 400;
static const int sButton = 225;
@ -295,19 +295,24 @@ void Engine::DrawPause()
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
PauseBGTexture.Bind();
MenuBGTexture.Bind();
glLoadIdentity();
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(0, 0);
glTexCoord2f(1, 0);
glVertex2i(800, 0);
glVertex2i(Width(), 0); //
glTexCoord2f(1, 1);
glVertex2i(800, 600);
glVertex2i(Width(), Height());
glTexCoord2f(0, 1);
glVertex2i(0, 600);
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);
@ -442,7 +447,9 @@ void Engine::LoadResource() {
LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png");
LoadTexture(PauseBGTexture, 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");
@ -1384,18 +1391,15 @@ void Engine::Render(float elapsedTime) {
}
}
else if (m_gamestate == GameState::MAIN_MENU || m_gamestate == GameState::OPTIONS)
else if (m_gamestate == GameState::MAIN_MENU)
{
if (!m_soloMultiChoiceMade) {
DisplaySingleOrMultiplayerMenu();
}
else {
DrawMenu();
}
DrawMenu();
}
else if (m_gamestate == GameState::PAUSE)
else if (m_gamestate == GameState::SINGLEMULTI)
DisplaySingleOrMultiplayerMenu();
else if (m_gamestate == GameState::OPTIONS)
{
DrawPause();
DrawOption();
}
else if (m_gamestate == GameState::QUIT)
Stop();
@ -1604,11 +1608,13 @@ 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::OPTIONS;
if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 450 && m_mousemy <= 500))
m_gamestate = GameState::QUIT;
}
else if (m_gamestate == GameState::OPTIONS)
else if (m_gamestate == GameState::SINGLEMULTI)
{
float buttonWidthProportion = 0.4f;
float buttonHeightProportion = 0.075f;

View File

@ -31,7 +31,7 @@ public:
Engine();
virtual ~Engine();
virtual void DrawMenu();
virtual void DrawPause();
virtual void DrawOption();
virtual void DrawSplachScreen();
virtual void Init();
virtual void DeInit();
@ -109,15 +109,20 @@ private:
netprot::ChunkMod* m_chunkmod = nullptr;
//Menu
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE };
enum class GameState: uint8_t { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY, PAUSE, SINGLEMULTI };
GameState m_gamestate = GameState::PLAY;
Texture MenuTitleTexture;
Texture MenuBGTexture;
Texture MenuBGOptionTexture;
Texture MenuStartTexture;
Texture MenuQuitTexture;
Texture MenuOptionsTexture;
Texture PauseBGTexture;
Texture SplachScreenTexture;
Texture MusicTexture; //TODO
Texture OnOffBtnTexture;//TODO
Texture BackBtnTexture;//TODO
Vector3f m_otherplayerpos = Vector3f(999, 999, 999);