Push zones cliquables sliders et checks

This commit is contained in:
mduval76 2023-12-01 14:37:12 -05:00
parent 3e3a7650e8
commit ac3628ec0b
2 changed files with 63 additions and 4 deletions

View File

@ -582,6 +582,9 @@ void Engine::DrawOption()
else if (m_selectedOption == 1) {
DisplayGraphicsMenu(centerX, centerY);
}
else if (m_selectedOption == 2) {
DisplayGameplayMenu(centerX, centerY);
}
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
@ -723,6 +726,28 @@ void Engine::DisplayGraphicsMenu(float centerX, float centerY) {
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
void Engine::DisplayGameplayMenu(float centerX, float centerY) {
glColor4f(1.0f, 0.5f, 0.0f, 1.0f);
m_textureSensibilite.Bind();
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.215);
glTexCoord2f(1, 0); glVertex2i(centerX, centerY + Height() * 0.215);
glTexCoord2f(1, 1); glVertex2i(centerX, centerY + Height() * 0.25);
glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.25);
glEnd();
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
glBindTexture(GL_TEXTURE_2D, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.165);
glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.3, centerY + Height() * 0.165);
glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.3, centerY + Height() * 0.2);
glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.2);
glEnd();
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
void Engine::InstantDamage()
{
m_player.InflictDamage(0.10f);
@ -1740,6 +1765,30 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
m_selectedOption = 2; // Gameplay
}
// Volume
float leftBar = centerX - Width() * 0.15f;
float rightBar = centerX + Width() * 0.3f;
float topBarPrincipal = centerY - Height() * 0.165f;
float bottomBarPrincipal = centerY - Height() * 0.2f;
float topBarMusique = centerY - Height() * 0.0415f;
float bottomBarMusique = centerY - Height() * 0.075f;
float topBarEffets = centerY + Height() * 0.085f;
float bottomBarEffets = centerY + Height() * 0.05f;
if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
std::cout << "Hit PRINCIPAL BAR" << std::endl;
}
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarMusique && y < topBarMusique) {
std::cout << "Hit MUSIQUE BAR" << std::endl;
}
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarEffets && y < topBarEffets) {
std::cout << "Hit EFFETS BAR" << std::endl;
}
// Resolution
float leftChk = centerX + Width() * 0.075f;
float rightChk = centerX + Width() * 0.09f;
@ -1755,18 +1804,27 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
float topChkUHD = centerY + Height() * 0.025f;
float bottomChkUHD = centerY;
if (leftChk && x < rightChk && y > bottomChkHD && y < topChkHD) {
if (m_selectedOption == 1 && leftChk && x < rightChk && y > bottomChkHD && y < topChkHD) {
std::cout << "HD" << std::endl;
m_resolution = HD;
}
if (x > leftChk && x < rightChk && y > bottomChkFHD && y < topChkFHD) {
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkFHD && y < topChkFHD) {
std::cout << "FHD" << std::endl;
m_resolution = FHD;
}
if (x > leftChk && x < rightChk && y > bottomChkQHD && y < topChkQHD) {
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkQHD && y < topChkQHD) {
std::cout << "QHD" << std::endl;
m_resolution = QHD;
}
if (x > leftChk && x < rightChk && y > bottomChkUHD && y < topChkUHD) {
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkUHD && y < topChkUHD) {
std::cout << "UHD" << std::endl;
m_resolution = UHD;
}
// Gameplay
if (m_selectedOption == 2 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
std::cout << "Hit SENSIBILITE BAR" << std::endl;
}
}
else if (m_gamestate == GameState::SINGLEMULTI)
{

View File

@ -63,6 +63,7 @@ private:
void DisplaySingleOrMultiplayerMenu();
void DisplayAudioMenu(float centerX, float centerY);
void DisplayGraphicsMenu(float centerX, float centerY);
void DisplayGameplayMenu(float centerX, float centerY);
void DrawHud(float elapsedTime, BlockType bloc);
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
void ProcessNotificationQueue();