diff --git a/SQCSim-common/player.h b/SQCSim-common/player.h index dbd4888..8a91cb5 100644 --- a/SQCSim-common/player.h +++ b/SQCSim-common/player.h @@ -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; diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index b87cff3..011df6b 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -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) { diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 51666bc..cd72257 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -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;