Push back button dans le lobbymenu

This commit is contained in:
mduval76 2023-12-14 18:25:15 -05:00
parent 1af88ba3e3
commit e5b0c742dd
3 changed files with 21 additions and 0 deletions

View File

@ -32,6 +32,7 @@ public:
Vector3f GetVelocity() const;
Vector3f GetPOV() const;
std::string GetUsername() const;
void SetUsername(std::string username);
float GetSensitivity() const;
void SetSensitivity(float sensitivity);
float GetHP() const;

View File

@ -753,6 +753,15 @@ void Engine::DisplayLobbyMenu(float elapsedTime) {
SetServerAddress(elapsedTime);
}
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
m_textureOptBack.Bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2i(Width() * 0.675, Height() * 0.15);
glTexCoord2f(1, 0); glVertex2i(Width() * 0.9, Height() * 0.15);
glTexCoord2f(1, 1); glVertex2i(Width() * 0.9, Height() * 0.225);
glTexCoord2f(0, 1); glVertex2i(Width() * 0.675, Height() * 0.225);
glEnd();
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
glEnable(GL_DEPTH_TEST);
@ -2380,6 +2389,16 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
m_audio.ToggleMusicState(m_gamestate);
}
}
else if (m_gamestate == GameState::LOBBY) {
float leftBack = centerX + Width() * 0.178f;
float rightBack = centerX + Width() * 0.397f;
float topBack = centerY + Height() * 0.346f;
float bottomBack = centerY + Height() * 0.275f;
if (leftBack && x < rightBack && y > bottomBack && y < topBack) {
m_gamestate = GameState::MAIN_MENU;
}
}
}
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {

View File

@ -208,6 +208,7 @@ private:
std::string m_currentInputString;
std::string m_username;
std::string m_serverAddr;
char m_inputChar = 0;
bool m_invalidChar = false;
bool m_charChanged = false;