diff --git a/SQCSim2021/define.h b/SQCSim2021/define.h index 28168bb..e8b9e47 100644 --- a/SQCSim2021/define.h +++ b/SQCSim2021/define.h @@ -34,9 +34,17 @@ #define SHADER_PATH "./media/shaders/" #define AUDIO_PATH "./media/audio/" #define CHUNK_PATH "./media/chunks/" -#define MENU_ITEM_PATH "./media/menu_items/" #define BOOSTER_TEXTURE_PATH "./media/textures/Booster/" +enum GameState { + MAIN_MENU, + SPLASH, + OPTIONS, + QUIT, + PLAY, + PAUSE +}; + enum Resolution { HD = 0, // 1280x720 (High Definition) FHD, // 1920x1080 (Full HD) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 39f3b72..d7b675a 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -18,7 +18,7 @@ struct Notification { // Use a vector to manage notifications std::vector notifications; -Engine::Engine() : m_remotePlayer(&m_pinfo), m_pinfo(){} +Engine::Engine() : m_remotePlayer(&m_pinfo), m_pinfo() {} Engine::~Engine() { m_world.CleanUpWorld(m_renderCount, true); @@ -29,7 +29,6 @@ Engine::~Engine() { } void Engine::Init() { - GLenum glewErr = glewInit(); if (glewErr != GLEW_OK) { std::cerr << " ERREUR GLEW : " << glewGetErrorString(glewErr) << std::endl; @@ -43,7 +42,6 @@ void Engine::Init() { glEnable(GL_STENCIL_TEST); glEnable(GL_POINT_SMOOTH); glEnable(GL_BLEND); - //glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); @@ -127,53 +125,48 @@ void Engine::Init() { m_startTime = std::chrono::high_resolution_clock::now(); m_remotePlayer.SetPosition(Vector3f(.5, CHUNK_SIZE_Y + 10., .5)); - // Gestion de souris. - CenterMouse(); - HideCursor(); } void Engine::DeInit() {} void Engine::LoadResource() { LoadTexture(m_skybox.GetTexture(), TEXTURE_PATH "skybox.png", true); - //LoadTexture(m_skybox2.GetTexture(), TEXTURE_PATH "skybox.png", true); LoadTexture(m_textureCrosshair, TEXTURE_PATH "cross.bmp", true); LoadTexture(m_textureFont, TEXTURE_PATH "font.bmp", true); LoadTexture(m_textureGun, TEXTURE_PATH "gun01.png", false); LoadTexture(m_texturePovGun, TEXTURE_PATH "GUN.png", false); - LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false); - LoadTexture(m_textureSoloText, TEXTURE_PATH "single_player.png", false); - LoadTexture(m_textureMultiText, TEXTURE_PATH "multi_player.png", false); - LoadTexture(m_textureSoloMultiMenu, TEXTURE_PATH "single_multi.png", false); - LoadTexture(m_textureTitle, TEXTURE_PATH "title.png", false); - LoadTexture(m_textureOptions, TEXTURE_PATH "Buttons/options.png", false); - LoadTexture(m_textureRetour, TEXTURE_PATH "Buttons/retour.png", false); - LoadTexture(m_textureVolume, TEXTURE_PATH "Buttons/volume.png", false); - LoadTexture(m_textureMusique, TEXTURE_PATH "Buttons/musique.png", false); - LoadTexture(m_textureGraphiques, TEXTURE_PATH "Buttons/graphiques.png", false); - LoadTexture(m_textureSensibilite, TEXTURE_PATH "Buttons/sensibilite.png", false); - LoadTexture(m_textureResolution, TEXTURE_PATH "Buttons/resolution.png", false); - LoadTexture(m_texturePrincipal, TEXTURE_PATH "Buttons/principal.png", false); - LoadTexture(m_textureEffets, TEXTURE_PATH "Buttons/effets.png", false); - LoadTexture(m_textureGameplay, TEXTURE_PATH "Buttons/gameplay.png", false); - LoadTexture(m_textureHd, TEXTURE_PATH "Buttons/hd.png", false); - LoadTexture(m_textureFhd, TEXTURE_PATH "Buttons/fhd.png", false); - LoadTexture(m_textureQhd, TEXTURE_PATH "Buttons/qhd.png", false); - LoadTexture(m_textureUhd, TEXTURE_PATH "Buttons/uhd.png", false); - LoadTexture(m_textureCheck, TEXTURE_PATH "Buttons/check.png", false); - LoadTexture(m_textureChecked, TEXTURE_PATH "Buttons/checked.png", false); + LoadTexture(m_textureMainMenu, TEXTURE_PATH "menus/backgrounds/bgMainMenu.png", false); + LoadTexture(m_texturePauseMenu, TEXTURE_PATH "menus/backgrounds/bgPause.png", false); + LoadTexture(m_textureOptionsMenu, TEXTURE_PATH "menus/backgrounds/bgOptions.png", false); + LoadTexture(m_textureSplashScreen, TEXTURE_PATH "menus/backgrounds/bgSplash.png", false); - // Pourquoi on load 3 fois la meme texture? - LoadTexture(MenuTitleTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png"); - LoadTexture(MenuBGTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png"); - LoadTexture(MenuBGOptionTexture, TEXTURE_PATH "BrouillonbackgroundMenu.png"); - LoadTexture(MenuBGFlouTexture, TEXTURE_PATH "BackgroundMenuFlou.png"); + LoadTexture(m_textureCheck, TEXTURE_PATH "menus/others/check.png", false); + LoadTexture(m_textureChecked, TEXTURE_PATH "menus/others/checked.png", false); - LoadTexture(SplachScreenTexture, TEXTURE_PATH "sc2.png"); - LoadTexture(MenuQuitTexture, MENU_ITEM_PATH "BasicQuit.png"); - LoadTexture(MenuOptionsTexture, MENU_ITEM_PATH "test.png"); - LoadTexture(MenuStartTexture, MENU_ITEM_PATH "BasicPlay.png"); + LoadTexture(m_textureOptAudio, TEXTURE_PATH "menus/buttons/options/optAudio.png", false); + LoadTexture(m_textureOptBack, TEXTURE_PATH "menus/buttons/options/optBack.png", false); + LoadTexture(m_textureOptGameplay, TEXTURE_PATH "menus/buttons/options/optGameplay.png", false); + LoadTexture(m_textureOptGraphics, TEXTURE_PATH "menus/buttons/options/optGraphics.png", false); + LoadTexture(m_textureOptMain, TEXTURE_PATH "menus/buttons/options/optMain.png", false); + LoadTexture(m_textureOptMusic, TEXTURE_PATH "menus/buttons/options/optMusic.png", false); + LoadTexture(m_textureOptOptions, TEXTURE_PATH "menus/buttons/options/optOptions.png", false); + LoadTexture(m_textureOptResolution, TEXTURE_PATH "menus/buttons/options/optResolution.png", false); + LoadTexture(m_textureOptSensitivity, TEXTURE_PATH "menus/buttons/options/optSensitivity.png", false); + LoadTexture(m_textureOptSfx, TEXTURE_PATH "menus/buttons/options/optSfx.png", false); + + LoadTexture(m_textureHd, TEXTURE_PATH "menus/labels/labelHd.png", false); + LoadTexture(m_textureFhd, TEXTURE_PATH "menus/labels/labelFhd.png", false); + LoadTexture(m_textureQhd, TEXTURE_PATH "menus/labels/labelQhd.png", false); + LoadTexture(m_textureUhd, TEXTURE_PATH "menus/labels/labelUhd.png", false); + LoadTexture(m_textureMenuTitle, TEXTURE_PATH "menus/labels/labelTitle.png", false); + + LoadTexture(m_textureMenuBack, TEXTURE_PATH "menus/buttons/main/mainBack.png", false); + LoadTexture(m_textureMenuMulti, TEXTURE_PATH "menus/buttons/main/mainMulti.png", false); + LoadTexture(m_textureMenuOptions, TEXTURE_PATH "menus/buttons/main/mainOptions.png", false); + LoadTexture(m_textureMenuPlay, TEXTURE_PATH "menus/buttons/main/mainPlay.png", false); + LoadTexture(m_textureMenuQuit, TEXTURE_PATH "menus/buttons/main/mainQuit.png", false); + LoadTexture(m_textureMenuSingle, TEXTURE_PATH "menus/buttons/main/mainSingle.png", false); TextureAtlas::TextureIndex texDirtIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal3.png"); TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png"); @@ -185,7 +178,6 @@ void Engine::LoadResource() { TextureAtlas::TextureIndex texBoostSpd = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterBleu.png"); TextureAtlas::TextureIndex texBoostInv = m_textureAtlas.AddTexture(BOOSTER_TEXTURE_PATH "BoosterJaune.png"); - //AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM //JUMP @@ -257,546 +249,9 @@ void Engine::LoadResource() { void Engine::UnloadResource() {} -void Engine::DrawSplachScreen() -{ - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - // Définir la matrice de projection en mode orthographique - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(-Width() / 2, Width() / 2, -Height() / 2, Height() / 2, -1, 1); - // Définir la matrice de modèle-vue - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - // L'image sera centrée autour de l'origine (0, 0, 0) - int imageWidth = Width(); // Remplacez par la largeur de votre image - int imageHeight = Height(); // Remplacez par la hauteur de votre image - - // Texture - SplachScreenTexture.Bind(); - - // Dessiner un quadrilatère centré - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(-imageWidth / 2, -imageHeight / 2); - glTexCoord2f(1, 0); - glVertex2i(imageWidth / 2, -imageHeight / 2); - glTexCoord2f(1, 1); - glVertex2i(imageWidth / 2, imageHeight / 2); - glTexCoord2f(0, 1); - glVertex2i(-imageWidth / 2, imageHeight / 2); - glEnd(); - - // Activer la transparence - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBlendEquation(GL_FUNC_ADD); - glEnable(GL_BLEND); - - // Restaurer les matrices précédentes - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - - m_gamestate = GameState::MAIN_MENU; -} - -void Engine::DrawMenu() -{ - 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(); - - MenuBGTexture.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); - - if (m_gamestate != GameState::OPTIONS) - { - MenuTitleTexture.Bind(); - glTranslated(200, 300, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 200); - glTexCoord2f(1, 0); - glVertex2i(sTitle, 200); - glTexCoord2f(1, 1); - glVertex2i(sTitle, 300); - glTexCoord2f(0, 1); - glVertex2i(0, 300); - glEnd(); - - MenuStartTexture.Bind(); - glTranslated(80, -225, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 100); - glTexCoord2f(1, 0); - glVertex2i(sButton , 100); - glTexCoord2f(1, 1); - glVertex2i(sButton, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - - MenuOptionsTexture.Bind(); - glTranslated(0, -100, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 125); - glTexCoord2f(1, 0); - glVertex2i(sButton, 125); - glTexCoord2f(1, 1); - glVertex2i(sButton, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - - MenuQuitTexture.Bind(); - glTranslated(0, -100, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 100); - glTexCoord2f(1, 0); - glVertex2i(sButton, 100); - glTexCoord2f(1, 1); - glVertex2i(sButton, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - - } - else - { - MenuOptionsTexture.Bind(); - glTranslated(200, 0, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 0); - glTexCoord2f(1, 0); - glVertex2i(sTitle, 0); - glTexCoord2f(1, 1); - glVertex2i(sTitle, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - - MusicTexture.Bind(); - glTranslated(200, 200, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 125); - glTexCoord2f(1, 0); - glVertex2i(sButton, 125); - glTexCoord2f(1, 1); - glVertex2i(sButton, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - - OnOffBtnTexture.Bind(); - glTranslated(200, 0, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 125); - glTexCoord2f(1, 0); - glVertex2i(sButton, 125); - glTexCoord2f(1, 1); - glVertex2i(sButton, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - - BackBtnTexture.Bind(); - glTranslated(-375, 175, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 140); - glTexCoord2f(1, 0); - glVertex2i(sButton, 140); - glTexCoord2f(1, 1); - glVertex2i(sButton, 200); - glTexCoord2f(0, 1); - glVertex2i(0, 200); - glEnd(); - } - - //glEnable(GL_LIGHTING); - glDisable(GL_BLEND); - glEnable(GL_DEPTH_TEST); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - ShowCursor(); -} - -void Engine::DrawOption() -{ - static const int sTitle = 400; - static const int sButton = 225; - - int centerX = Width() * 0.5f; - int centerY = Height() * 0.5f; - - GLint viewport[4]; - glGetIntegerv(GL_VIEWPORT, viewport); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBlendEquation(GL_FUNC_ADD); - - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - - glLoadIdentity(); - glOrtho(0, Width(), 0, Height(), -1, 1); - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - MenuBGFlouTexture.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(); - - glColor4f(0.85f, 0.95f, 0.0f, 1.0f); - m_textureOptions.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.175, centerY + Height() * 0.35); - glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.175, centerY + Height() * 0.35); - glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.175, centerY + Height() * 0.45); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.175, centerY + Height() * 0.45); - glEnd(); - - if (m_selectedOption == 0) { - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - } - m_textureVolume.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.35, centerY + Height() * 0.2); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.2); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.25); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.35, centerY + Height() * 0.25); - glEnd(); - - glColor4f(0.85f, 0.95f, 0.0f, 1.0f); - if (m_selectedOption == 1) { - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - } - m_textureGraphiques.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.4, centerY + Height() * 0.05); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.05); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.1); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.4, centerY + Height() * 0.1); - glEnd(); - - glColor4f(0.85f, 0.95f, 0.0f, 1.0f); - if (m_selectedOption == 2) { - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - } - m_textureGameplay.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.375, centerY - Height() * 0.1); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.2, centerY - Height() * 0.1); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.2, centerY - Height() * 0.05); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.375, centerY - Height() * 0.05); - glEnd(); - - // Séparateur - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - glBindTexture(GL_TEXTURE_2D, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.175, centerY - Height() * 0.1); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.1751, centerY - Height() * 0.1); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.1751, centerY + Height() * 0.25); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.175, centerY + Height() * 0.25); - glEnd(); - - glColor4f(0.85f, 0.95f, 0.0f, 1.0f); - m_textureRetour.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.25); - glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.075, centerY - Height() * 0.25); - glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.075, centerY - Height() * 0.2); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.2); - glEnd(); - - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - if (m_selectedOption == 0) { - DisplayAudioMenu(centerX, centerY); - } - 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]); - - glEnable(GL_STENCIL_TEST); - glEnable(GL_DEPTH_TEST); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); -} - -void Engine::DisplayAudioMenu(float centerX, float centerY) { - float minBar = centerX - Width() * 0.15; - float maxBar = centerX + Width() * 0.3; - float percentPosX = centerX + Width() * 0.31f; - - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - m_texturePrincipal.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.215); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.025, centerY + Height() * 0.215); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.025, centerY + Height() * 0.25); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.25); - glEnd(); - - float principalBottom = centerY + Height() * 0.165f; - float principalTop = centerY + Height() * 0.2f; - - DrawSliderBackground(centerX, centerY, minBar, maxBar, principalBottom, principalTop); - RedrawSlider(centerX, centerY, m_volPrincipal, minBar, maxBar, principalBottom, principalTop); - DisplayBarPercentValue(centerX, centerY, percentPosX, principalBottom, minBar, maxBar, m_volPrincipal); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBlendEquation(GL_FUNC_ADD); - - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - m_textureMusique.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.09); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.05, centerY + Height() * 0.09); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.05, centerY + Height() * 0.125); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.125); - glEnd(); - - float musiqueBottom = centerY + Height() * 0.04f; - float musiqueTop = centerY + Height() * 0.075f; - - DrawSliderBackground(centerX, centerY, minBar, maxBar, musiqueBottom, musiqueTop); - RedrawSlider(centerX, centerY, m_volMusique, minBar, maxBar, musiqueBottom, musiqueTop); - DisplayBarPercentValue(centerX, centerY, percentPosX, musiqueBottom, minBar, maxBar, m_volMusique); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBlendEquation(GL_FUNC_ADD); - - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - m_textureEffets.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY - Height() * 0.035); - glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.035); - glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.00001); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY - Height() * 0.00001); - glEnd(); - - float effectsBottom = centerY - Height() * 0.085f; - float effectsTop = centerY - Height() * 0.05f; - - DrawSliderBackground(centerX, centerY, minBar, maxBar, effectsBottom, effectsTop); - RedrawSlider(centerX, centerY, m_volEffets, minBar, maxBar, effectsBottom, effectsTop); - DisplayBarPercentValue(centerX, centerY, percentPosX, effectsBottom, minBar, maxBar, m_volEffets); - - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -} - -void Engine::DisplayGraphicsMenu(float centerX, float centerY) { - glColor4f(1.0f, 0.5f, 0.0f, 1.0f); - m_textureResolution.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); - m_textureHd.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.125); - glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.05, centerY + Height() * 0.125); - glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.05, centerY + Height() * 0.15); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.15); - glEnd(); - - m_textureFhd.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.075); - glTexCoord2f(1, 0); glVertex2i(centerX, centerY + Height() * 0.075); - glTexCoord2f(1, 1); glVertex2i(centerX, centerY + Height() * 0.1); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.1); - glEnd(); - - m_textureQhd.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.025); - glTexCoord2f(1, 0); glVertex2i(centerX, centerY + Height() * 0.025); - glTexCoord2f(1, 1); glVertex2i(centerX, centerY + Height() * 0.05); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.05); - glEnd(); - - m_textureUhd.Bind(); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY - Height() * 0.025); - glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.015, centerY - Height() * 0.025); - glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.015, centerY); - glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY); - glEnd(); - - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - float heightRatioBottom = 0.125f; - float heightRatioTop = 0.15; - - // Checkboxes - for (int i = 0; i < 4; i++) { - if (static_cast(m_resolution) == i) { - m_textureChecked.Bind(); - } - else { - m_textureCheck.Bind(); - } - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(centerX + Width() * 0.075, centerY + Height() * heightRatioBottom); - glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.09, centerY + Height() * heightRatioBottom); - glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.09, centerY + Height() * heightRatioTop); - glTexCoord2f(0, 1); glVertex2i(centerX + Width() * 0.075, centerY + Height() * heightRatioTop); - glEnd(); - - heightRatioBottom -= 0.05f; - heightRatioTop -= 0.05f; - } - - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -} - -void Engine::DisplayGameplayMenu(float centerX, float centerY) { - float minBar = centerX - Width() * 0.15; - float maxBar = centerX + Width() * 0.3; - float percentPosX = centerX + Width() * 0.31f; - - 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(); - - float sensibleBottom = centerY + Height() * 0.165f; - float sensibleTop = centerY + Height() * 0.2f; - - DrawSliderBackground(centerX, centerY, minBar, maxBar, sensibleBottom, sensibleTop); - RedrawSlider(centerX, centerY, m_volSensible, minBar, maxBar, sensibleBottom, sensibleTop); - DisplayBarPercentValue(centerX, centerY, percentPosX, sensibleBottom, minBar, maxBar, m_volSensible); - - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); -} - -void Engine::DrawSliderBackground(float centerX, float centerY, float minVal, float maxVal, float bottomSideValue, float topSideValue) { - glColor4f(0.0f, 0.0f, 0.0f, 1.0f); - glBindTexture(GL_TEXTURE_2D, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(minVal, bottomSideValue); - glTexCoord2f(1, 0); glVertex2i(maxVal, bottomSideValue); - glTexCoord2f(1, 1); glVertex2i(maxVal, topSideValue); - glTexCoord2f(0, 1); glVertex2i(minVal, topSideValue); - glEnd(); -} - -void Engine::DisplayBarPercentValue(float centerX, float centerY, float posX, float posY, float minVal, float maxVal, float value) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - - float percentage = (value / (maxVal - minVal)) * 100; - - if (percentage < 0.0f) { - percentage = 0.0f; - } - else if (percentage > 100.0f) { - percentage = 100.0f; - } - - m_textureFont.Bind(); - std::ostringstream ss; - ss.str(""); - ss << std::fixed << std::setprecision(2); - ss << percentage << "%"; - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - PrintText(posX, posY, ss.str(), 2.0f); - - glDisable(GL_BLEND); -} - -void Engine::RedrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue) { - if (value < 0.0f) { - value = 0.0f; - } - else if (value > (maxVal - minVal)) { - value = (maxVal - minVal); - } - - if (value >= 0.0f && value <= (maxVal - minVal)) { - glColor4f(0.0f, 1.0f, 0.0f, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex2i(minVal, bottomSideValue); - glTexCoord2f(1, 0); glVertex2i(minVal + value, bottomSideValue); - glTexCoord2f(1, 1); glVertex2i(minVal + value, topSideValue); - glTexCoord2f(0, 1); glVertex2i(minVal, topSideValue); - glEnd(); - } -} - -void Engine::InstantDamage() -{ +void Engine::InstantDamage() { m_player.InflictDamage(0.10f); m_damage = false; } @@ -899,58 +354,6 @@ void Engine::DisplayCrosshair() { glEnd(); } -void Engine::DisplayPovGun() { - // Setter le blend function, tout ce qui sera noir sera transparent - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glBlendEquation(GL_FUNC_ADD); - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - - glLoadIdentity(); - glOrtho(0, Width(), 0, Height(), -1, 1); - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - - float baseXOffsetPercentage = 0.4958; - float baseWidthPercentage = 0.4688; - float baseHeightPercentage = 0.5787; - - float xTranslation = baseXOffsetPercentage * Width(); - float quadWidth = baseWidthPercentage * Width(); - float quadHeight = baseHeightPercentage * Height(); - - m_texturePovGun.Bind(); - glLoadIdentity(); - glTranslated(xTranslation, 0, 0); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2i(0, 0); - glTexCoord2f(1, 0); - glVertex2i(quadWidth, 0); - glTexCoord2f(1, 1); - glVertex2i(quadWidth, quadHeight); - glTexCoord2f(0, 1); - glVertex2i(0, quadHeight); - glEnd(); - - // Reset du blend function - glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); - glBlendEquation(GL_FUNC_SUBTRACT); - - glEnable(GL_STENCIL_TEST); - glEnable(GL_DEPTH_TEST); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); -} - void Engine::DisplayCurrentItem() {} void Engine::DisplayHud(int timer) { @@ -1013,12 +416,12 @@ void Engine::DisplayHud(int timer) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor3f(1.0f * facteurOmbrage, 1.0f * facteurOmbrage, 1.0f * facteurOmbrage); - float equipWidthProportion = 0.8f; - float equipHeightProportion = 0.7f; + float equipWidthProportion = 0.8f; + float equipHeightProportion = 0.7f; float equipWidth = itemBackgroundWidth * equipWidthProportion; float equipHeight = itemBackgroundHeight * equipHeightProportion; float equipXOffset = itemBackgroundXPos + (itemBackgroundWidth - equipWidth) * 0.1f; - float equipYOffset = itemBackgroundYPos + (itemBackgroundHeight - equipHeight) * 0.75f; + float equipYOffset = itemBackgroundYPos + (itemBackgroundHeight - equipHeight) * 0.75f; glTranslatef(equipXOffset, equipYOffset, 0); @@ -1046,7 +449,7 @@ void Engine::DisplayHud(int timer) { ss.str(""); ss << m_player.GetHP() * 100 << "%"; PrintText(itemBackgroundXPos * 5.25f, fUsernamePosY, ss.str(), 1.5f); - + float countdownXOffset = Width() * 0.2f; float countdownYOffset = Height() * 0.1f; float countdownXPos = Width() - countdownXOffset; @@ -1058,6 +461,169 @@ void Engine::DisplayHud(int timer) { PrintText(countdownXPos, countdownYPos, ss.str(), 2.0f); } +void Engine::DrawHud(float elapsedTime, BlockType bloc) { + // Setter le blend function, tout ce qui sera noir sera transparent + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + glBlendEquation(GL_FUNC_ADD); + glEnable(GL_BLEND); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + + glLoadIdentity(); + glOrtho(0, Width(), 0, Height(), -1, 1); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + + int timer = GetCountdown(elapsedTime); + for (int i = 1; i < WORLD_SIZE_X; i++) { + if (timer <= COUNTDOWN - m_timerReductionChunk * i) { + m_world.RemoveChunk(m_nbReductionChunk * i); + m_renderer.RemoveChunk(m_nbReductionChunk * i); + } + } + if (m_keyK) { + SystemNotification(m_messageNotification); + m_keyK = false; + } + if (m_keyL) { + + KillNotification(m_player, m_player); + m_keyL = false; + } + + if (m_displayInfo) { + DisplayInfo(elapsedTime, bloc); + } + + if (m_displayHud) { + DisplayHud(timer); + } + + if (m_displayCrosshair) { + DisplayCrosshair(); + } + + glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); + glBlendEquation(GL_FUNC_SUBTRACT); + + glEnable(GL_STENCIL_TEST); + glEnable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +} + +void Engine::DisplayPovGun() { + // Setter le blend function, tout ce qui sera noir sera transparent + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendEquation(GL_FUNC_ADD); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + + glLoadIdentity(); + glOrtho(0, Width(), 0, Height(), -1, 1); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + + float baseXOffsetPercentage = 0.4958; + float baseWidthPercentage = 0.4688; + float baseHeightPercentage = 0.5787; + + float xTranslation = baseXOffsetPercentage * Width(); + float quadWidth = baseWidthPercentage * Width(); + float quadHeight = baseHeightPercentage * Height(); + + m_texturePovGun.Bind(); + glLoadIdentity(); + glTranslated(xTranslation, 0, 0); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2i(0, 0); + glTexCoord2f(1, 0); + glVertex2i(quadWidth, 0); + glTexCoord2f(1, 1); + glVertex2i(quadWidth, quadHeight); + glTexCoord2f(0, 1); + glVertex2i(0, quadHeight); + glEnd(); + + // Reset du blend function + glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); + glBlendEquation(GL_FUNC_SUBTRACT); + + glEnable(GL_STENCIL_TEST); + glEnable(GL_DEPTH_TEST); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +} + +void Engine::PrintText(float x, float y, const std::string& t, float charSizeMultiplier) { + float windowWidth = static_cast(Width()); + float windowHeight = static_cast(Height()); + + float posX = x * windowWidth; + float posY = y * windowHeight; + + float baseCharSize = 20 + (24 - 20) * (windowWidth - 1600) / (1920 - 1600); + float charSize = baseCharSize * charSizeMultiplier; + + glPushMatrix(); + glLoadIdentity(); + glTranslated(x, y, 0); + + for (unsigned int i = 0; i < t.length(); ++i) { + float left = (float)((t[i] - 32) % 16) / 16.f; + float top = (float)((t[i] - 32) / 16) / 16.f; + top += 0.5f; + + glBegin(GL_QUADS); + glTexCoord2f(left, 1.f - top - .0625f); glVertex2f(0, 0); + glTexCoord2f(left + .0625f, 1.f - top - .0625f); glVertex2f(charSize, 0); + glTexCoord2f(left + .0625f, 1.f - top); glVertex2f(charSize, charSize); + glTexCoord2f(left, 1.f - top); glVertex2f(0, charSize); + glEnd(); + + glTranslated(0.5555f * charSize, 0, 0); + } + glPopMatrix(); +} + +int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; } + +int Engine::GetCountdown(float elapsedTime) { + if (m_resetcountdown) { + m_nbReductionChunk = 4; + m_timerReductionChunk = 30; + m_countdown = m_time + COUNTDOWN; + m_resetcountdown = false; + } + if (m_countdown < m_time) + Stop(); + if (!m_stopcountdown) + m_time += elapsedTime; + return m_countdown - (int)m_time; +} + +int Engine::GetOptionsChoice() { + return m_selectedOption; +} + void Engine::DisplayInfo(float elapsedTime, BlockType bloc) { m_textureFont.Bind(); std::ostringstream ss; @@ -1112,17 +678,58 @@ void Engine::DisplayInfo(float elapsedTime, BlockType bloc) { PrintText(fPosX, fPosYJump, ss.str()); } -void Engine::DisplaySingleOrMultiplayerMenu() { +void Engine::DisplaySplashScreen() { + glDisable(GL_LIGHTING); + glDisable(GL_DEPTH_TEST); + glDisable(GL_STENCIL_TEST); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-Width() / 2, Width() / 2, -Height() / 2, Height() / 2, -1, 1); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + int imageWidth = Width(); + int imageHeight = Height(); + + m_textureSplashScreen.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(-imageWidth / 2, -imageHeight / 2); + glTexCoord2f(1, 0); glVertex2i(imageWidth / 2, -imageHeight / 2); + glTexCoord2f(1, 1); glVertex2i(imageWidth / 2, imageHeight / 2); + glTexCoord2f(0, 1); glVertex2i(-imageWidth / 2, imageHeight / 2); + glEnd(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); +} + +void Engine::DisplayPauseMenu() { + + m_texturePauseMenu.Bind(); + 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(); +} + +void Engine::DisplayMainMenu() { GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendEquation(GL_FUNC_ADD); - glDisable(GL_STENCIL_TEST); - glDisable(GL_DEPTH_TEST); - glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -1133,7 +740,7 @@ void Engine::DisplaySingleOrMultiplayerMenu() { glPushMatrix(); // Background - m_textureSoloMultiMenu.Bind(); + m_textureMainMenu.Bind(); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex2f(Width(), 0.0f); @@ -1142,81 +749,31 @@ void Engine::DisplaySingleOrMultiplayerMenu() { glEnd(); // Title - float titleWidthProportion = 0.4f; - float titleHeightProportion = 0.4f; - float titleWidth = titleWidthProportion * Width(); - float titleHeight = titleHeightProportion * Height(); - float offsetTitleXFactor = 0.05f; - float offsetTitleYFactor = 0.05f; - m_titleX = (Width() - titleWidth) - (offsetTitleXFactor * Width()); - m_titleY = (Height() - titleHeight) - (offsetTitleYFactor * Height()); + float centerX = Width() * 0.5f; + float centerY = Height() * 0.5f; - m_textureTitle.Bind(); glColor4f(1.0f, 0.5f, 0.0f, 1.0f); + m_textureMenuTitle.Bind(); glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(m_titleX, m_titleY); - glTexCoord2f(1.0f, 0.0f); glVertex2f(m_titleX + titleWidth, m_titleY); - glTexCoord2f(1.0f, 1.0f); glVertex2f(m_titleX + titleWidth, m_titleY + titleHeight); - glTexCoord2f(0.0f, 1.0f); glVertex2f(m_titleX, m_titleY + titleHeight); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.05, centerY + Height() * 0.05); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.45, centerY + Height() * 0.05); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.45, centerY + Height() * 0.45); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.05, centerY + Height() * 0.45); glEnd(); - glBindTexture(GL_TEXTURE_2D, 0); + DrawButtonBackgrounds(centerX, centerY, 3); - - // Single Player and Multiplayer button background quads - float buttonWidthProportion = 0.4f; - float buttonHeightProportion = 0.075f; - float buttonWidth = buttonWidthProportion * Width(); - float buttonHeight = buttonHeightProportion * Height(); - float offsetSingleButtonXFactor = 0.075f; - float offsetSingleButtonYFactor = 0.05f; - - float buttonPosX = m_titleX; - float buttonSinglePosY = m_titleY - buttonHeight - (offsetSingleButtonYFactor * Height()); - float buttonMultiPosY = (buttonSinglePosY * 0.75); - - // Single Player background - glColor4f(1.0f, 1.0f, 1.0f, 0.5f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonSinglePosY); - glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY); - glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY + buttonHeight); - glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonSinglePosY + buttonHeight); - glEnd(); - - // Single Player text - m_textureSoloText.Bind(); - glColor4f(0.75f, 0.05f, 0.0f, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonSinglePosY); - glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY); - glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonSinglePosY + buttonHeight); - glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonSinglePosY + buttonHeight); - glEnd(); - - glBindTexture(GL_TEXTURE_2D, 0); - // Multi Player background - glColor4f(1.0f, 1.0f, 1.0f, 0.5f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonMultiPosY); - glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY); - glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY + buttonHeight); - glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonMultiPosY + buttonHeight); - glEnd(); - - // Multi Player text - m_textureMultiText.Bind(); - glColor4f(0.75f, 0.05f, 0.0f, 1.0f); - glBegin(GL_QUADS); - glTexCoord2f(0.0f, 0.0f); glVertex2f(buttonPosX, buttonMultiPosY); - glTexCoord2f(1.0f, 0.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY); - glTexCoord2f(1.0f, 1.0f); glVertex2f(buttonPosX + buttonWidth, buttonMultiPosY + buttonHeight); - glTexCoord2f(0.0f, 1.0f); glVertex2f(buttonPosX, buttonMultiPosY + buttonHeight); - glEnd(); + if (m_gamestate == GameState::MAIN_MENU) { + if (m_selectedPlayOptions) { + DrawSingleMultiButtons(centerX, centerY); + } + else { + DrawMainMenuButtons(centerX, centerY); + } + } glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - // Reset the state glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); glEnable(GL_STENCIL_TEST); @@ -1231,128 +788,379 @@ void Engine::DisplaySingleOrMultiplayerMenu() { ShowCursor(); } -void Engine::DrawHud(float elapsedTime, BlockType bloc) { - // Setter le blend function, tout ce qui sera noir sera transparent +void Engine::DrawMainMenuButtons(float centerX, float centerY) { + m_textureMenuPlay.Bind(); + glColor4f(0.75f, 0.05f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.16, centerY - Height() * 0.065); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.34, centerY - Height() * 0.065); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.34, centerY - Height() * 0.01); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.16, centerY - Height() * 0.01); + glEnd(); + + m_textureMenuOptions.Bind(); + glColor4f(0.75f, 0.05f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.08, centerY - Height() * 0.165); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.42, centerY - Height() * 0.165); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.42, centerY - Height() * 0.11); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.08, centerY - Height() * 0.11); + glEnd(); + + m_textureMenuQuit.Bind(); + glColor4f(0.75f, 0.05f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.16, centerY - Height() * 0.265); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.34, centerY - Height() * 0.265); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.34, centerY - Height() * 0.21); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.16, centerY - Height() * 0.21); + glEnd(); +} + +void Engine::DrawSingleMultiButtons(float centerX, float centerY) { + m_textureMenuSingle.Bind(); + glColor4f(0.75f, 0.05f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.06, centerY - Height() * 0.065); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.44, centerY - Height() * 0.065); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.44, centerY - Height() * 0.01); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.06, centerY - Height() * 0.01); + glEnd(); + + m_textureMenuMulti.Bind(); + glColor4f(0.75f, 0.05f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.08, centerY - Height() * 0.165); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.42, centerY - Height() * 0.165); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.42, centerY - Height() * 0.11); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.08, centerY - Height() * 0.11); + glEnd(); + + m_textureMenuBack.Bind(); + glColor4f(0.75f, 0.05f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.16, centerY - Height() * 0.265); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.34, centerY - Height() * 0.265); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.34, centerY - Height() * 0.21); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.16, centerY - Height() * 0.21); + glEnd(); +} + +void Engine::DrawButtonBackgrounds(float centerX, float centerY, int iterations) { + glColor4f(1.0f, 1.0f, 1.0f, 0.5f); + glBindTexture(GL_TEXTURE_2D, 0); + + float bottomOffset = 0.075f; + float topOffset = 0.0f; + float distanceBetween = 0.1f; + + for (int i = 0; i < iterations; i++) { + glBegin(GL_QUADS); + glTexCoord2f(0.0f, 0.0f); glVertex2f(centerX + Width() * 0.05, centerY - Height() * bottomOffset); + glTexCoord2f(1.0f, 0.0f); glVertex2f(centerX + Width() * 0.45, centerY - Height() * bottomOffset); + glTexCoord2f(1.0f, 1.0f); glVertex2f(centerX + Width() * 0.45, centerY - Height() * topOffset); + glTexCoord2f(0.0f, 1.0f); glVertex2f(centerX + Width() * 0.05, centerY - Height() * topOffset); + glEnd(); + + bottomOffset += distanceBetween; + topOffset += distanceBetween; + } +} + +void Engine::DisplayOptionsMenu() { + static const int sTitle = 400; + static const int sButton = 225; + + float centerX = Width() * 0.5f; + float centerY = Height() * 0.5f; + + GLint viewport[4]; + glGetIntegerv(GL_VIEWPORT, viewport); + glDisable(GL_STENCIL_TEST); glDisable(GL_DEPTH_TEST); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE); - glBlendEquation(GL_FUNC_ADD); glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendEquation(GL_FUNC_ADD); glMatrixMode(GL_PROJECTION); glPushMatrix(); - glLoadIdentity(); glOrtho(0, Width(), 0, Height(), -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - int timer = GetCountdown(elapsedTime); - for (int i = 1; i < WORLD_SIZE_X; i++) - { - if (timer <= COUNTDOWN - m_timerReductionChunk * i) { - m_world.RemoveChunk(m_nbReductionChunk * i); - m_renderer.RemoveChunk(m_nbReductionChunk * i); - } - } - if (m_keyK) { - SystemNotification(m_messageNotification); - m_keyK = false; - } - if (m_keyL) { + m_textureOptionsMenu.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(); - KillNotification(m_player, m_player); - m_keyL = false; + glColor4f(1.0f, 0.0f, 1.0f, 1.0f); + m_textureOptOptions.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.175, centerY + Height() * 0.35); + glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.175, centerY + Height() * 0.35); + glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.175, centerY + Height() * 0.45); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.175, centerY + Height() * 0.45); + glEnd(); + + if (m_selectedOption == 0) { + glColor4f(0.5f, 1.0f, 0.0f, 1.0f); + } + m_textureOptAudio.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.35, centerY + Height() * 0.2); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.2); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.25); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.35, centerY + Height() * 0.25); + glEnd(); + + glColor4f(1.0f, 0.0f, 1.0f, 1.0f); + if (m_selectedOption == 1) { + glColor4f(0.5f, 1.0f, 0.0f, 1.0f); + } + m_textureOptGraphics.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.4, centerY + Height() * 0.05); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.05); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.2, centerY + Height() * 0.1); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.4, centerY + Height() * 0.1); + glEnd(); + + glColor4f(1.0f, 0.0f, 1.0f, 1.0f); + if (m_selectedOption == 2) { + glColor4f(0.5f, 1.0f, 0.0f, 1.0f); + } + m_textureOptGameplay.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.375, centerY - Height() * 0.1); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.2, centerY - Height() * 0.1); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.2, centerY - Height() * 0.05); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.375, centerY - Height() * 0.05); + glEnd(); + + // Séparateur + glColor4f(0.0f, 0.0f, 0.0f, 1.0f); + glBindTexture(GL_TEXTURE_2D, 0); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.175, centerY - Height() * 0.1); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.18, centerY - Height() * 0.1); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.18, centerY + Height() * 0.25); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.175, centerY + Height() * 0.25); + glEnd(); + + glColor4f(1.0f, 0.0f, 1.0f, 1.0f); + m_textureOptBack.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.25); + glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.075, centerY - Height() * 0.25); + glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.075, centerY - Height() * 0.2); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.2); + glEnd(); + + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + if (m_selectedOption == 0) { + DisplayAudioMenu(centerX, centerY); + } + else if (m_selectedOption == 1) { + DisplayGraphicsMenu(centerX, centerY); + } + else if (m_selectedOption == 2) { + DisplayGameplayMenu(centerX, centerY); } - if (m_displayInfo) { - DisplayInfo(elapsedTime, bloc); - } - - if (m_displayHud) { - DisplayHud(timer); - } - - if (m_displayCrosshair) { - DisplayCrosshair(); - } - - glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR); - glBlendEquation(GL_FUNC_SUBTRACT); + glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); glEnable(GL_STENCIL_TEST); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glPopMatrix(); - glMatrixMode(GL_MODELVIEW); glPopMatrix(); } -void Engine::PrintText(float x, float y, const std::string& t, float charSizeMultiplier) { - float windowWidth = static_cast(Width()); - float windowHeight = static_cast(Height()); +void Engine::DisplayAudioMenu(float centerX, float centerY) { + float minBar = centerX - Width() * 0.15; + float maxBar = centerX + Width() * 0.3; + float percentPosX = centerX + Width() * 0.31f; - float posX = x * windowWidth; - float posY = y * windowHeight; + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + m_textureOptMain.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.215); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.075, centerY + Height() * 0.215); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.075, centerY + Height() * 0.25); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.25); + glEnd(); - float baseCharSize = 20 + (24 - 20) * (windowWidth - 1600) / (1920 - 1600); - float charSize = baseCharSize * charSizeMultiplier; + float principalBottom = centerY + Height() * 0.165f; + float principalTop = centerY + Height() * 0.2f; - glPushMatrix(); - glLoadIdentity(); - glTranslated(x, y, 0); + DrawSliderBackground(centerX, centerY, minBar, maxBar, principalBottom, principalTop); + DrawSlider(centerX, centerY, m_volPrincipal, minBar, maxBar, principalBottom, principalTop); + DisplayBarPercentValue(centerX, centerY, percentPosX, principalBottom, minBar, maxBar, m_volPrincipal); - for (unsigned int i = 0; i < t.length(); ++i) { - float left = (float)((t[i] - 32) % 16) / 16.f; - float top = (float)((t[i] - 32) / 16) / 16.f; - top += 0.5f; + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendEquation(GL_FUNC_ADD); + + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + m_textureOptMusic.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.09); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.05, centerY + Height() * 0.09); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.05, centerY + Height() * 0.125); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.125); + glEnd(); + + float musiqueBottom = centerY + Height() * 0.04f; + float musiqueTop = centerY + Height() * 0.075f; + + DrawSliderBackground(centerX, centerY, minBar, maxBar, musiqueBottom, musiqueTop); + DrawSlider(centerX, centerY, m_volMusique, minBar, maxBar, musiqueBottom, musiqueTop); + DisplayBarPercentValue(centerX, centerY, percentPosX, musiqueBottom, minBar, maxBar, m_volMusique); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glBlendEquation(GL_FUNC_ADD); + + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + m_textureOptSfx.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY - Height() * 0.035); + glTexCoord2f(1, 0); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.035); + glTexCoord2f(1, 1); glVertex2i(centerX - Width() * 0.075, centerY - Height() * 0.00001); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY - Height() * 0.00001); + glEnd(); + + float effectsBottom = centerY - Height() * 0.085f; + float effectsTop = centerY - Height() * 0.05f; + + DrawSliderBackground(centerX, centerY, minBar, maxBar, effectsBottom, effectsTop); + DrawSlider(centerX, centerY, m_volEffets, minBar, maxBar, effectsBottom, effectsTop); + DisplayBarPercentValue(centerX, centerY, percentPosX, effectsBottom, minBar, maxBar, m_volEffets); + + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); +} + +void Engine::DisplayGraphicsMenu(float centerX, float centerY) { + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + m_textureOptResolution.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(1.0f, 1.0f, 1.0f, 0.5f); + glBindTexture(GL_TEXTURE_2D, 0); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.16, centerY + Height() * 0.165); + glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.1, centerY + Height() * 0.165); + glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.1, centerY - Height() * 0.04); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.16, centerY - Height() * 0.04); + glEnd(); + + glColor4f(0.0f, 0.0f, 0.0f, 1.0f); + m_textureHd.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.125); + glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.05, centerY + Height() * 0.125); + glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.05, centerY + Height() * 0.15); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.15); + glEnd(); + + m_textureFhd.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.075); + glTexCoord2f(1, 0); glVertex2i(centerX, centerY + Height() * 0.075); + glTexCoord2f(1, 1); glVertex2i(centerX, centerY + Height() * 0.1); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.1); + glEnd(); + + m_textureQhd.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.025); + glTexCoord2f(1, 0); glVertex2i(centerX, centerY + Height() * 0.025); + glTexCoord2f(1, 1); glVertex2i(centerX, centerY + Height() * 0.05); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY + Height() * 0.05); + glEnd(); + + m_textureUhd.Bind(); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(centerX - Width() * 0.15, centerY - Height() * 0.025); + glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.015, centerY - Height() * 0.025); + glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.015, centerY); + glTexCoord2f(0, 1); glVertex2i(centerX - Width() * 0.15, centerY); + glEnd(); + + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + + float heightRatioBottom = 0.125f; + float heightRatioTop = 0.15; + + // Checkboxes + for (int i = 0; i < 4; i++) { + if (static_cast(m_resolution) == i) { + m_textureChecked.Bind(); + } + else { + m_textureCheck.Bind(); + } glBegin(GL_QUADS); - glTexCoord2f(left, 1.f - top - .0625f); glVertex2f(0, 0); - glTexCoord2f(left + .0625f, 1.f - top - .0625f); glVertex2f(charSize, 0); - glTexCoord2f(left + .0625f, 1.f - top); glVertex2f(charSize, charSize); - glTexCoord2f(left, 1.f - top); glVertex2f(0, charSize); + glTexCoord2f(0, 0); glVertex2i(centerX + Width() * 0.075, centerY + Height() * heightRatioBottom); + glTexCoord2f(1, 0); glVertex2i(centerX + Width() * 0.09, centerY + Height() * heightRatioBottom); + glTexCoord2f(1, 1); glVertex2i(centerX + Width() * 0.09, centerY + Height() * heightRatioTop); + glTexCoord2f(0, 1); glVertex2i(centerX + Width() * 0.075, centerY + Height() * heightRatioTop); glEnd(); - glTranslated(0.5555f * charSize, 0, 0); + heightRatioBottom -= 0.05f; + heightRatioTop -= 0.05f; } - glPopMatrix(); -} -int Engine::GetFps(float elapsedTime) const { return 1 / elapsedTime; } - -int Engine::GetCountdown(float elapsedTime) { - if (m_resetcountdown) - { - m_nbReductionChunk = 4; - m_timerReductionChunk = 30; - m_countdown = m_time + COUNTDOWN; - m_resetcountdown = false; - } - if (m_countdown < m_time) - Stop(); - if (!m_stopcountdown) - m_time += elapsedTime; - return m_countdown - (int)m_time; -} - -int Engine::GetOptionsChoice() { - return m_selectedOption; + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } void Engine::Render(float elapsedTime) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - m_time_SplashScreen += elapsedTime; - if (m_time_SplashScreen < 2) { - DrawSplachScreen(); + if (m_gamestate == GameState::SPLASH) { + if (m_splashTime > 0.0f) { + DisplaySplashScreen(); + } + else { + m_gamestate = GameState::MAIN_MENU; + } + + m_splashTime -= elapsedTime; + return; } - else if (m_gamestate == GameState::PLAY) - { + + if (m_gamestate == GameState::MAIN_MENU) { + DisplayMainMenu(); + return; + } + + if (m_gamestate == GameState::OPTIONS) { + DisplayOptionsMenu(); + return; + } + + if (m_gamestate == GameState::PAUSE) { + DisplayPauseMenu(); + return; + } + + if (m_gamestate == GameState::PLAY) { HideCursor(); CenterMouse(); //D�placement de centermouse dans l'action de jouer @@ -1406,7 +1214,7 @@ void Engine::Render(float elapsedTime) { m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation // (donc l'objet ne bouge pas relativement au joueur, ce qui est pratique pour une skybox!). - + m_player.ApplyTransformation(remotePlayer, true, false); if (m_key1) bloc++; @@ -1488,8 +1296,7 @@ void Engine::Render(float elapsedTime) { DrawHud(elapsedTime, bloc); DisplayPovGun(); ProcessNotificationQueue(); - if (m_damage) - { + if (m_damage) { InstantDamage(); } static bool fell = false; @@ -1563,20 +1370,88 @@ void Engine::Render(float elapsedTime) { lsPck.clear(); } } - else if (m_gamestate == GameState::MAIN_MENU) - { - DrawMenu(); - } - else if (m_gamestate == GameState::SINGLEMULTI) - DisplaySingleOrMultiplayerMenu(); - else if (m_gamestate == GameState::OPTIONS || m_gamestate == GameState::PAUSE) - { - DrawOption(); - } - else if (m_gamestate == GameState::QUIT) - Stop(); } +void Engine::DisplayGameplayMenu(float centerX, float centerY) { + float minBar = centerX - Width() * 0.15; + float maxBar = centerX + Width() * 0.3; + float percentPosX = centerX + Width() * 0.31f; + + glColor4f(1.0f, 1.0f, 0.0f, 1.0f); + m_textureOptSensitivity.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(); + + float sensibleBottom = centerY + Height() * 0.165f; + float sensibleTop = centerY + Height() * 0.2f; + + DrawSliderBackground(centerX, centerY, minBar, maxBar, sensibleBottom, sensibleTop); + DrawSlider(centerX, centerY, m_volSensible, minBar, maxBar, sensibleBottom, sensibleTop); + DisplayBarPercentValue(centerX, centerY, percentPosX, sensibleBottom, minBar, maxBar, m_volSensible); + + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); +} + +void Engine::DrawSliderBackground(float centerX, float centerY, float minVal, float maxVal, float bottomSideValue, float topSideValue) { + glColor4f(0.0f, 0.0f, 0.0f, 1.0f); + glBindTexture(GL_TEXTURE_2D, 0); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(minVal, bottomSideValue); + glTexCoord2f(1, 0); glVertex2i(maxVal, bottomSideValue); + glTexCoord2f(1, 1); glVertex2i(maxVal, topSideValue); + glTexCoord2f(0, 1); glVertex2i(minVal, topSideValue); + glEnd(); +} + +void Engine::DisplayBarPercentValue(float centerX, float centerY, float posX, float posY, float minVal, float maxVal, float value) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE); + + float percentage = (value / (maxVal - minVal)) * 100; + + if (percentage < 0.0f) { + percentage = 0.0f; + } + else if (percentage > 100.0f) { + percentage = 100.0f; + } + + m_textureFont.Bind(); + std::ostringstream ss; + ss.str(""); + ss << std::fixed << std::setprecision(2); + ss << percentage << "%"; + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + PrintText(posX, posY, ss.str(), 2.0f); + + glDisable(GL_BLEND); +} + +void Engine::DrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue) { + if (value < 0.0f) { + value = 0.0f; + } + else if (value > (maxVal - minVal)) { + value = (maxVal - minVal); + } + + if (value >= 0.0f && value <= (maxVal - minVal)) { + glColor4f(0.0f, 1.0f, 0.0f, 1.0f); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2i(minVal, bottomSideValue); + glTexCoord2f(1, 0); glVertex2i(minVal + value, bottomSideValue); + glTexCoord2f(1, 1); glVertex2i(minVal + value, topSideValue); + glTexCoord2f(0, 1); glVertex2i(minVal, topSideValue); + glEnd(); + } +} + + + void Engine::KeyPressEvent(unsigned char key) { switch (key) { case 0: // A - Gauche @@ -1600,12 +1475,10 @@ void Engine::KeyPressEvent(unsigned char key) { } break; case 36: // ESC - Quitter - if (m_gamestate == GameState::PLAY) - { + if (m_gamestate == GameState::PLAY) { m_gamestate = GameState::PAUSE; } - else if (m_gamestate == GameState::PAUSE) - { + else if (m_gamestate == GameState::PAUSE) { m_gamestate = GameState::PLAY; } //Stop(); @@ -1750,22 +1623,25 @@ void Engine::MouseMoveEvent(int x, int y) { if (x == (Width() / 2) && y == (Height() / 2)) return; } + else if (m_gamestate == GameState::MAIN_MENU) { + DisplayMainMenu(); + } else if (m_gamestate == GameState::OPTIONS) { float centerX = Width() * 0.5f; float centerY = Height() * 0.5f; float leftBar = centerX - Width() * 0.15f; float rightBar = centerX + Width() * 0.3f; - if (m_selectedOption == 0 && m_selectedPrincipalBar) { + if (m_selectedOption == 0 && m_selectedOptAudioMainBar) { m_volPrincipal = x - leftBar; } - else if (m_selectedOption == 0 && m_selectedMusiqueBar) { + else if (m_selectedOption == 0 && m_selectedOptAudioMusicBar) { m_volMusique = x - leftBar; } - else if (m_selectedOption == 0 && m_selectedEffetsBar) { + else if (m_selectedOption == 0 && m_selectedOptAudioSfxBar) { m_volEffets = x - leftBar; } - else if (m_selectedOption == 2 && m_selectedSensibleBar) { + else if (m_selectedOption == 2 && m_selectedGameplaySensitivityBar) { m_volSensible = x - leftBar; } } @@ -1774,9 +1650,10 @@ void Engine::MouseMoveEvent(int x, int y) { void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { m_mousemx = x; m_mousemy = y; + float centerX = Width() * 0.5f; + float centerY = Height() * 0.5f; - if (m_gamestate == GameState::PLAY) - { + if (m_gamestate == GameState::PLAY) { switch (button) { case MOUSE_BUTTON_LEFT: m_mouseL = true; @@ -1796,23 +1673,50 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { case MOUSE_BUTTON_NONE: break; } } - else if (m_gamestate == GameState::MAIN_MENU) - { - 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::OPTIONS; - if ((m_mousemx >= 305 && m_mousemx <= 450) && (m_mousemy >= 450 && m_mousemy <= 500)) - m_gamestate = GameState::QUIT; + else if (m_gamestate == GameState::MAIN_MENU) { + + float leftButton = centerX + Width() * 0.045f; + float rightButton = centerX + Width() * 0.4455f; + + float topFirst = centerY + Height() * 0.073f; + float bottomFirst = centerY; + + float topSecond = centerY + Height() * 0.177f; + float bottomSecond = centerY + Height() * 0.105f; + + float topThird = centerY + Height() * 0.275f; + float bottomThird = centerY + Height() * 0.198f; + + if (x > leftButton && x < rightButton && y > bottomFirst && y < topFirst) { + if (m_selectedPlayOptions) { + m_gamestate = GameState::PLAY; + } + else { + m_selectedPlayOptions = true; + } + } + else if (x > leftButton && x < rightButton && y > bottomSecond && y < topSecond) { + if (m_selectedPlayOptions) { + m_gamestate = GameState::PLAY; + } + else { + m_gamestate = GameState::OPTIONS; + } + } + else if (x > leftButton && x < rightButton && y > bottomThird && y < topThird) { + if (m_selectedPlayOptions) { + m_selectedPlayOptions = false; + } + else { + m_gamestate = GameState::QUIT; + } + } } else if (m_gamestate == GameState::OPTIONS) { - float centerX = Width() * 0.5f; - float centerY = Height() * 0.5f; - - float leftVol = centerX - Width() * 0.35f; - float rightVol = centerX - Width() * 0.2f; - float topVol = (Height() * 0.25f) + ((Height() * 0.25f) - (Height() * 0.2f)); - float bottomVol = (Height() * 0.2f) + ((Height() * 0.25f) - (Height() * 0.2f)); + float leftAudio = centerX - Width() * 0.35f; + float rightAudio = centerX - Width() * 0.2f; + float topAudio = (Height() * 0.25f) + ((Height() * 0.25f) - (Height() * 0.2f)); + float bottomAudio = (Height() * 0.2f) + ((Height() * 0.25f) - (Height() * 0.2f)); float leftGraph = centerX - Width() * 0.4f; float rightGraph = centerX - Width() * 0.2f; @@ -1824,12 +1728,12 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { float topGameplay = centerY + Height() * 0.1f; float bottomGameplay = centerY + Height() * 0.05f; - float leftRetour = centerX - Width() * 0.075f; - float rightRetour = centerX + Width() * 0.075f; - float topRetour = centerY + Height() * 0.25f; - float bottomRetour = centerY + Height() * 0.2f; + float leftBack = centerX - Width() * 0.075f; + float rightBack = centerX + Width() * 0.075f; + float topBack = centerY + Height() * 0.25f; + float bottomBack = centerY + Height() * 0.2f; - if (x > leftVol && x < rightVol && y > bottomVol && y < topVol) { + if (x > leftAudio && x < rightAudio && y > bottomAudio && y < topAudio) { m_selectedOption = 0; // Volume } else if (x > leftGraph && x < rightGraph && y > bottomGraph && y < topGraph) { @@ -1838,11 +1742,11 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { else if (x > leftGameplay && x < rightGameplay && y > bottomGameplay && y < topGameplay) { m_selectedOption = 2; // Gameplay } - else if (x > leftRetour && x < rightRetour && y > bottomRetour && y < topRetour) { + else if (x > leftBack && x < rightBack && y > bottomBack && y < topBack) { m_gamestate = GameState::MAIN_MENU; } - // Volume + // Audio float leftBar = centerX - Width() * 0.15f; float rightBar = centerX + Width() * 0.3f; @@ -1857,15 +1761,15 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) { m_volPrincipal = x - leftBar; - m_selectedPrincipalBar = true; + m_selectedOptAudioMainBar = true; } else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarMusique && y < topBarMusique) { m_volMusique = x - leftBar; - m_selectedMusiqueBar = true; + m_selectedOptAudioMusicBar = true; } else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarEffets && y < topBarEffets) { m_volEffets = x - leftBar; - m_selectedEffetsBar = true; + m_selectedOptAudioSfxBar = true; } // Resolution @@ -1900,36 +1804,7 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) { // Gameplay if (m_selectedOption == 2 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) { m_volSensible = x - leftBar; - m_selectedSensibleBar = true; - } - } - else if (m_gamestate == GameState::SINGLEMULTI) - { - float buttonWidthProportion = 0.4f; - float buttonHeightProportion = 0.075f; - float buttonWidth = buttonWidthProportion * Width(); - float buttonHeight = buttonHeightProportion * Height(); - float offsetSingleButtonXFactor = 0.075f; - float offsetSingleButtonYFactor = 0.05f; - - float buttonPosX = m_titleX; - float buttonSinglePosY = m_titleY - buttonHeight - (offsetSingleButtonYFactor * Height()); - float buttonMultiPosY = buttonSinglePosY * 0.75; - float adjustedMouseY = Height() - m_mousemy; - - // Single Player - if (m_mousemx >= buttonPosX && m_mousemx <= (buttonPosX + buttonWidth) && - adjustedMouseY >= buttonSinglePosY && adjustedMouseY <= (buttonSinglePosY + buttonHeight)) - { - m_soloMultiChoiceMade = true; - m_gamestate = GameState::PLAY; - } - // Multiplayer - else if (m_mousemx >= buttonPosX && m_mousemx <= (buttonPosX + buttonWidth) && - adjustedMouseY >= buttonMultiPosY && adjustedMouseY <= (buttonMultiPosY + buttonHeight)) - { - m_soloMultiChoiceMade = true; - m_gamestate = GameState::PLAY; + m_selectedGameplaySensitivityBar = true; } } } @@ -1939,10 +1814,10 @@ void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) { case MOUSE_BUTTON_LEFT: m_mouseL = false; m_block = false; - m_selectedPrincipalBar = false; - m_selectedMusiqueBar = false; - m_selectedEffetsBar = false; - m_selectedSensibleBar = false; + m_selectedOptAudioMainBar = false; + m_selectedOptAudioMusicBar = false; + m_selectedOptAudioSfxBar = false; + m_selectedGameplaySensitivityBar = false; break; case MOUSE_BUTTON_RIGHT: m_mouseR = false; diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 093c4cb..aff6ebd 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -30,9 +30,6 @@ class Engine : public OpenglContext { public: Engine(); virtual ~Engine(); - virtual void DrawMenu(); - virtual void DrawOption(); - virtual void DrawSplachScreen(); virtual void Init(); virtual void DeInit(); virtual void LoadResource(); @@ -54,53 +51,82 @@ private: void InstantDamage(); void SystemNotification(std::string systemLog); void KillNotification(Player killer, Player killed); + void DisplayNotification(std::string message); void DisplayCrosshair(); void DisplayPovGun(); void DisplayCurrentItem(); void DisplayHud(int timer); + void DrawHud(float elapsedTime, BlockType bloc); void DisplayInfo(float elapsedTime, BlockType bloc); - void DisplaySingleOrMultiplayerMenu(); + + void DisplaySplashScreen(); + void DisplayPauseMenu(); + + void DisplayMainMenu(); + void DrawButtonBackgrounds(float centerX, float centerY, int iterations); + void DrawMainMenuButtons(float centerX, float centerY); + void DrawSingleMultiButtons(float centerX, float centerY); + + void DisplayOptionsMenu(); void DisplayAudioMenu(float centerX, float centerY); void DisplayGraphicsMenu(float centerX, float centerY); void DisplayGameplayMenu(float centerX, float centerY); void DrawSliderBackground(float centerX, float centerY, float minVal, float maxVal, float bottomSideValue, float topSideValue); void DisplayBarPercentValue(float centerX, float centerY, float posX, float posY, float minVal, float maxVal, float value); - void RedrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue); - void DrawHud(float elapsedTime, BlockType bloc); + void DrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue); + + void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f); void ProcessNotificationQueue(); Connector m_conn; - Shader m_shader01; + + Audio m_audio = Audio(AUDIO_PATH "start.wav"); + irrklang::ISound* m_powpow, * m_scream; + irrklang::ISound* m_whoosh[MAX_BULLETS]; + + Bullet* m_bullets[MAX_BULLETS]; + + std::chrono::high_resolution_clock::time_point m_startTime; + std::unordered_map m_players; + netprot::Buffer m_buf, m_bufout; + + netprot::PlayerInfo m_pinfo; + RemotePlayer m_remotePlayer = RemotePlayer(netprot::PlayerInfo(), Vector3f(5.5f, CHUNK_SIZE_Y + 1.8f, 5.5f)); + std::string m_messageNotification = ""; + + World m_world = World(); + Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); + + Renderer m_renderer = Renderer(); + + Booster m_booster = Booster(); BlockInfo* m_blockinfo[BTYPE_LAST]; BoostInfo* m_boostinfo[BTYPE_BOOST_LAST]; + + GameState m_gamestate = GameState::SPLASH; + + Shader m_shader01; + + Skybox m_skybox; + TextureAtlas m_textureAtlas = TextureAtlas(BTYPE_LAST); TextureAtlas m_animeAtlas = TextureAtlas(TYPE_LAST + POS_LAST); - World m_world = World(); - Renderer m_renderer = Renderer(); - Booster m_booster = Booster(); + TextureAtlas::TextureIndex texBoostHeal; Texture m_textureCrosshair; Texture m_textureFont; Texture m_textureGun; Texture m_texturePovGun; Texture m_textureSkybox; - Texture m_textureSoloMultiMenu; - Texture m_textureSoloText; - Texture m_textureMultiText; - Texture m_textureTitle; - Texture m_textureOptions; - Texture m_textureRetour; - Texture m_textureVolume; - Texture m_textureMusique; - Texture m_textureGraphiques; - Texture m_textureSensibilite; - Texture m_textureResolution; - Texture m_texturePrincipal; - Texture m_textureEffets; - Texture m_textureGameplay; + + Texture m_textureMainMenu; + Texture m_textureOptionsMenu; + Texture m_texturePauseMenu; + Texture m_textureSplashScreen; + Texture m_textureHd; Texture m_textureFhd; Texture m_textureQhd; @@ -108,46 +134,32 @@ private: Texture m_textureCheck; Texture m_textureChecked; - TextureAtlas::TextureIndex texBoostHeal; + Texture m_textureOptAudio; + Texture m_textureOptBack; + Texture m_textureOptGameplay; + Texture m_textureOptGraphics; + Texture m_textureOptMain; + Texture m_textureOptMusic; + Texture m_textureOptOptions; + Texture m_textureOptResolution; + Texture m_textureOptSensitivity; + Texture m_textureOptSfx; - Skybox m_skybox; - Audio m_audio = Audio(AUDIO_PATH "start.wav"); + Texture m_textureMenuBack; + Texture m_textureMenuMulti; + Texture m_textureMenuOptions; + Texture m_textureMenuPlay; + Texture m_textureMenuQuit; + Texture m_textureMenuSingle; + Texture m_textureMenuTitle; - irrklang::ISound* m_powpow, - * m_scream; - irrklang::ISound *m_whoosh[MAX_BULLETS]; - - Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); - Settings m_parameters = Settings(m_audio); - - Bullet* m_bullets[MAX_BULLETS]; - - std::unordered_map m_players; - netprot::Buffer m_buf, m_bufout; - std::chrono::high_resolution_clock::time_point m_startTime; - - //Menu - enum class GameState: uint8_t { MAIN_MENU, OPTIONS, SETTINGS, QUIT, NEWG, PLAY, PAUSE, SINGLEMULTI }; - - GameState m_gamestate = GameState::MAIN_MENU; - Texture MenuTitleTexture; - Texture MenuBGTexture; - Texture MenuBGFlouTexture; - Texture MenuBGOptionTexture; - Texture MenuStartTexture; - Texture MenuQuitTexture; - Texture MenuOptionsTexture; - Texture PauseBGTexture; - Texture SplachScreenTexture; - Texture MusicTexture; //TODO - Texture OnOffBtnTexture;//TODO - Texture BackBtnTexture;//TODO + Settings m_options = Settings(m_audio); Resolution m_resolution = HD; + float m_splashTime = 2.0f; float m_scale; float m_time = 0; - float m_time_SplashScreen = 0; float m_titleX = 0; float m_titleY = 0; @@ -163,10 +175,10 @@ private: int m_selectedOption = 0; - bool m_selectedPrincipalBar = false; - bool m_selectedMusiqueBar = false; - bool m_selectedEffetsBar = false; - bool m_selectedSensibleBar = false; + bool m_selectedOptAudioMainBar = false; + bool m_selectedOptAudioMusicBar = false; + bool m_selectedOptAudioSfxBar = false; + bool m_selectedGameplaySensitivityBar = false; bool m_damage = false; @@ -180,10 +192,13 @@ private: bool m_resetcountdown = false; bool m_soloMultiChoiceMade = false; bool m_stopcountdown = false; + + bool m_selectedPlayOptions = false; + bool m_selectedOptions = false; + bool m_selectedQuit = false; bool m_key1 = false; bool m_key2 = false; - bool m_keyK = false; bool m_keyL = false; bool m_keyW = false; @@ -191,19 +206,17 @@ private: bool m_keyS = false; bool m_keyD = false; bool m_keySpace = false; + bool m_mouseL = false; bool m_mouseR = false; bool m_mouseC = false; bool m_mouseWU = false; bool m_mouseWD = false; - //Pour trouver ou est la souris + float m_mousemx = 0; float m_mousemy = 0; bool m_networkgame = false; - netprot::PlayerInfo m_pinfo; - RemotePlayer m_remotePlayer = RemotePlayer(netprot::PlayerInfo(),Vector3f(5.5f, CHUNK_SIZE_Y + 1.8f, 5.5f)); - std::string m_messageNotification = ""; }; #endif // ENGINE_H__ diff --git a/SQCSim2021/media/textures/BackgroundMenuFlou.png b/SQCSim2021/media/textures/BackgroundMenuFlou.png deleted file mode 100644 index 84840f7..0000000 Binary files a/SQCSim2021/media/textures/BackgroundMenuFlou.png and /dev/null differ diff --git a/SQCSim2021/media/textures/BrouillonbackgroundMenu.png b/SQCSim2021/media/textures/BrouillonbackgroundMenu.png deleted file mode 100644 index ba8631c..0000000 Binary files a/SQCSim2021/media/textures/BrouillonbackgroundMenu.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/effets.png b/SQCSim2021/media/textures/Buttons/effets.png deleted file mode 100644 index 30c8be6..0000000 Binary files a/SQCSim2021/media/textures/Buttons/effets.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/graphiques.png b/SQCSim2021/media/textures/Buttons/graphiques.png deleted file mode 100644 index 860179f..0000000 Binary files a/SQCSim2021/media/textures/Buttons/graphiques.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/musique.png b/SQCSim2021/media/textures/Buttons/musique.png deleted file mode 100644 index 37707b2..0000000 Binary files a/SQCSim2021/media/textures/Buttons/musique.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/principal.png b/SQCSim2021/media/textures/Buttons/principal.png deleted file mode 100644 index ad06d7d..0000000 Binary files a/SQCSim2021/media/textures/Buttons/principal.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/retour.png b/SQCSim2021/media/textures/Buttons/retour.png deleted file mode 100644 index 8f676d5..0000000 Binary files a/SQCSim2021/media/textures/Buttons/retour.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/sensibilite.png b/SQCSim2021/media/textures/Buttons/sensibilite.png deleted file mode 100644 index 47208b6..0000000 Binary files a/SQCSim2021/media/textures/Buttons/sensibilite.png and /dev/null differ diff --git a/SQCSim2021/media/textures/Buttons/volume.png b/SQCSim2021/media/textures/Buttons/volume.png deleted file mode 100644 index 043432c..0000000 Binary files a/SQCSim2021/media/textures/Buttons/volume.png and /dev/null differ diff --git a/SQCSim2021/media/textures/single_multi.png b/SQCSim2021/media/textures/menus/backgrounds/bgMainMenu.png similarity index 100% rename from SQCSim2021/media/textures/single_multi.png rename to SQCSim2021/media/textures/menus/backgrounds/bgMainMenu.png diff --git a/SQCSim2021/media/textures/menus/backgrounds/bgOptions.png b/SQCSim2021/media/textures/menus/backgrounds/bgOptions.png new file mode 100644 index 0000000..3a8dc45 Binary files /dev/null and b/SQCSim2021/media/textures/menus/backgrounds/bgOptions.png differ diff --git a/SQCSim2021/media/textures/menus/backgrounds/bgPause.png b/SQCSim2021/media/textures/menus/backgrounds/bgPause.png new file mode 100644 index 0000000..c236e26 Binary files /dev/null and b/SQCSim2021/media/textures/menus/backgrounds/bgPause.png differ diff --git a/SQCSim2021/media/textures/sc2.png b/SQCSim2021/media/textures/menus/backgrounds/bgSplash.png similarity index 100% rename from SQCSim2021/media/textures/sc2.png rename to SQCSim2021/media/textures/menus/backgrounds/bgSplash.png diff --git a/SQCSim2021/media/textures/menus/buttons/main/mainBack.png b/SQCSim2021/media/textures/menus/buttons/main/mainBack.png new file mode 100644 index 0000000..8a0e568 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/main/mainBack.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/main/mainMulti.png b/SQCSim2021/media/textures/menus/buttons/main/mainMulti.png new file mode 100644 index 0000000..502891a Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/main/mainMulti.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/main/mainOptions.png b/SQCSim2021/media/textures/menus/buttons/main/mainOptions.png new file mode 100644 index 0000000..8984ca6 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/main/mainOptions.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/main/mainPlay.png b/SQCSim2021/media/textures/menus/buttons/main/mainPlay.png new file mode 100644 index 0000000..0cfbb14 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/main/mainPlay.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/main/mainQuit.png b/SQCSim2021/media/textures/menus/buttons/main/mainQuit.png new file mode 100644 index 0000000..0c61ab4 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/main/mainQuit.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/main/mainSingle.png b/SQCSim2021/media/textures/menus/buttons/main/mainSingle.png new file mode 100644 index 0000000..6fe2074 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/main/mainSingle.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/options/optAudio.png b/SQCSim2021/media/textures/menus/buttons/options/optAudio.png new file mode 100644 index 0000000..de3bbf4 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optAudio.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/options/optBack.png b/SQCSim2021/media/textures/menus/buttons/options/optBack.png new file mode 100644 index 0000000..03e2563 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optBack.png differ diff --git a/SQCSim2021/media/textures/Buttons/gameplay.png b/SQCSim2021/media/textures/menus/buttons/options/optGameplay.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/gameplay.png rename to SQCSim2021/media/textures/menus/buttons/options/optGameplay.png diff --git a/SQCSim2021/media/textures/menus/buttons/options/optGraphics.png b/SQCSim2021/media/textures/menus/buttons/options/optGraphics.png new file mode 100644 index 0000000..8aa8b66 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optGraphics.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/options/optMain.png b/SQCSim2021/media/textures/menus/buttons/options/optMain.png new file mode 100644 index 0000000..c9e1098 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optMain.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/options/optMusic.png b/SQCSim2021/media/textures/menus/buttons/options/optMusic.png new file mode 100644 index 0000000..c6f4d57 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optMusic.png differ diff --git a/SQCSim2021/media/textures/Buttons/options.png b/SQCSim2021/media/textures/menus/buttons/options/optOptions.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/options.png rename to SQCSim2021/media/textures/menus/buttons/options/optOptions.png diff --git a/SQCSim2021/media/textures/Buttons/resolution.png b/SQCSim2021/media/textures/menus/buttons/options/optResolution.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/resolution.png rename to SQCSim2021/media/textures/menus/buttons/options/optResolution.png diff --git a/SQCSim2021/media/textures/menus/buttons/options/optSensitivity.png b/SQCSim2021/media/textures/menus/buttons/options/optSensitivity.png new file mode 100644 index 0000000..b8af10f Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optSensitivity.png differ diff --git a/SQCSim2021/media/textures/menus/buttons/options/optSfx.png b/SQCSim2021/media/textures/menus/buttons/options/optSfx.png new file mode 100644 index 0000000..43babb6 Binary files /dev/null and b/SQCSim2021/media/textures/menus/buttons/options/optSfx.png differ diff --git a/SQCSim2021/media/textures/Buttons/fhd.png b/SQCSim2021/media/textures/menus/labels/labelFhd.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/fhd.png rename to SQCSim2021/media/textures/menus/labels/labelFhd.png diff --git a/SQCSim2021/media/textures/Buttons/hd.png b/SQCSim2021/media/textures/menus/labels/labelHd.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/hd.png rename to SQCSim2021/media/textures/menus/labels/labelHd.png diff --git a/SQCSim2021/media/textures/Buttons/qhd.png b/SQCSim2021/media/textures/menus/labels/labelQhd.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/qhd.png rename to SQCSim2021/media/textures/menus/labels/labelQhd.png diff --git a/SQCSim2021/media/textures/title.png b/SQCSim2021/media/textures/menus/labels/labelTitle.png similarity index 100% rename from SQCSim2021/media/textures/title.png rename to SQCSim2021/media/textures/menus/labels/labelTitle.png diff --git a/SQCSim2021/media/textures/Buttons/uhd.png b/SQCSim2021/media/textures/menus/labels/labelUhd.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/uhd.png rename to SQCSim2021/media/textures/menus/labels/labelUhd.png diff --git a/SQCSim2021/media/textures/Buttons/check.png b/SQCSim2021/media/textures/menus/others/check.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/check.png rename to SQCSim2021/media/textures/menus/others/check.png diff --git a/SQCSim2021/media/textures/Buttons/checked.png b/SQCSim2021/media/textures/menus/others/checked.png similarity index 100% rename from SQCSim2021/media/textures/Buttons/checked.png rename to SQCSim2021/media/textures/menus/others/checked.png diff --git a/SQCSim2021/media/textures/multi_player.png b/SQCSim2021/media/textures/multi_player.png deleted file mode 100644 index d8db6e0..0000000 Binary files a/SQCSim2021/media/textures/multi_player.png and /dev/null differ diff --git a/SQCSim2021/media/textures/single_player.png b/SQCSim2021/media/textures/single_player.png deleted file mode 100644 index f553d08..0000000 Binary files a/SQCSim2021/media/textures/single_player.png and /dev/null differ