|
|
|
@@ -167,7 +167,6 @@ void Engine::LoadResource() {
|
|
|
|
|
TextureAtlas::TextureIndex StillQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueBackRightShootingRightShoot1.png"); ////23
|
|
|
|
|
TextureAtlas::TextureIndex StillBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2 "BlueShootingBackRightShoot1.png"); ////24
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//JUMP
|
|
|
|
|
TextureAtlas::TextureIndex JumpFront = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueFrontJumpRight.png"); ////25
|
|
|
|
|
TextureAtlas::TextureIndex JumpQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftFrontJumpLeft.png"); ////26
|
|
|
|
@@ -178,7 +177,6 @@ void Engine::LoadResource() {
|
|
|
|
|
TextureAtlas::TextureIndex JumpQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightBackJumpRight.png"); ////31
|
|
|
|
|
TextureAtlas::TextureIndex JumpBack = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueBackJumpRight.png"); ////32
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//SHOOTINGJUMP SANS TIRER
|
|
|
|
|
TextureAtlas::TextureIndex JumpFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontJumpRightShootingRight.png"); ////33
|
|
|
|
|
TextureAtlas::TextureIndex JumpQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueFrontLeftJumpLeftShootingLeft.png"); ////34
|
|
|
|
@@ -189,7 +187,6 @@ void Engine::LoadResource() {
|
|
|
|
|
TextureAtlas::TextureIndex JumpQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackRightJumpRightShootingRight.png"); ////39
|
|
|
|
|
TextureAtlas::TextureIndex JumpBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1 "BlueBackJumpRightShootingRight.png"); ////40
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//SHOOTINGJUMP TIRER
|
|
|
|
|
TextureAtlas::TextureIndex JumpFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontJumpRightShootingRightShoot1.png"); ////41
|
|
|
|
|
TextureAtlas::TextureIndex JumpQuarterFrontLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueFrontLeftJumpLeftShootingLeftShoot1.png"); ////42
|
|
|
|
@@ -200,8 +197,6 @@ void Engine::LoadResource() {
|
|
|
|
|
TextureAtlas::TextureIndex JumpQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackRightJumpRightShootingRightShoot1.png"); ////47
|
|
|
|
|
TextureAtlas::TextureIndex JumpBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2 "BlueBackJumpRightShootingRightShoot1.png"); ////48
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_animeAtlas.Generate(TEXTURE_SIZE, false)) {
|
|
|
|
|
std::cout << " Unable to generate texture atlas ..." << std::endl;
|
|
|
|
|
abort();
|
|
|
|
@@ -233,8 +228,6 @@ void Engine::LoadResource() {
|
|
|
|
|
m_boostinfo[BTYPE_INVINCIBLE] = new BoostInfo(BTYPE_INVINCIBLE, "Inv", u, v, s, 1);
|
|
|
|
|
|
|
|
|
|
m_animeAtlas.TextureIndexToCoord(0, u, v, s, s);
|
|
|
|
|
m_sensitivity = m_player.GetSensitivity();
|
|
|
|
|
m_options.SetMouseSensitivity(m_sensitivity);
|
|
|
|
|
|
|
|
|
|
std::cout << " Loading and compiling shaders ..." << std::endl;
|
|
|
|
|
if (!m_shader01.Load(SHADER_PATH "shader01.vert", SHADER_PATH "shader01.frag", true)) {
|
|
|
|
@@ -246,6 +239,13 @@ void Engine::LoadResource() {
|
|
|
|
|
std::cout << " Failed to load shader " << std::endl;
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Settings
|
|
|
|
|
m_musicvolume = m_audio.GetMusicVolume();
|
|
|
|
|
m_options.SetMusicVolume(m_musicvolume);
|
|
|
|
|
|
|
|
|
|
m_sensitivity = m_player.GetSensitivity();
|
|
|
|
|
m_options.SetMouseSensitivity(m_sensitivity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Engine::UnloadResource() {}
|
|
|
|
@@ -1117,8 +1117,8 @@ void Engine::DisplayAudioMenu(float centerX, float centerY) {
|
|
|
|
|
float principalTop = centerY + Height() * 0.2f;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
DrawSlider(centerX, centerY, m_mainvolume, minBar, maxBar, principalBottom, principalTop);
|
|
|
|
|
DisplayBarPercentValue(centerX, centerY, percentPosX, principalBottom, minBar, maxBar, m_mainvolume);
|
|
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
@@ -1137,8 +1137,8 @@ void Engine::DisplayAudioMenu(float centerX, float centerY) {
|
|
|
|
|
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);
|
|
|
|
|
DrawSlider(centerX, centerY, m_musicvolume, minBar, maxBar, musiqueBottom, musiqueTop);
|
|
|
|
|
DisplayBarPercentValue(centerX, centerY, percentPosX, musiqueBottom, minBar, maxBar, m_musicvolume);
|
|
|
|
|
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
@@ -1157,8 +1157,8 @@ void Engine::DisplayAudioMenu(float centerX, float centerY) {
|
|
|
|
|
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);
|
|
|
|
|
DrawSlider(centerX, centerY, m_sfxvolume, minBar, maxBar, effectsBottom, effectsTop);
|
|
|
|
|
DisplayBarPercentValue(centerX, centerY, percentPosX, effectsBottom, minBar, maxBar, m_sfxvolume);
|
|
|
|
|
|
|
|
|
|
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
|
|
|
|
}
|
|
|
|
@@ -1651,22 +1651,23 @@ void Engine::DisplayBarPercentValue(float centerX, float centerY, float posX, fl
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
|
|
|
|
|
|
|
|
|
if (value < 0.1f) {
|
|
|
|
|
value = 0.1f;
|
|
|
|
|
if (m_selectedOption == 0) {
|
|
|
|
|
if (value < 0.0f) {
|
|
|
|
|
value = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (value > 1.0f) {
|
|
|
|
|
else {
|
|
|
|
|
if (value < 0.1f) {
|
|
|
|
|
value = 0.1f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (value > 1.0f) {
|
|
|
|
|
value = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float percentage = value * 100;
|
|
|
|
|
|
|
|
|
|
if (percentage < 0.0f) {
|
|
|
|
|
percentage = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
else if (percentage > 100.0f) {
|
|
|
|
|
percentage = 100.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_textureFont.Bind();
|
|
|
|
|
std::ostringstream ss;
|
|
|
|
|
ss.str("");
|
|
|
|
@@ -1681,10 +1682,18 @@ void Engine::DisplayBarPercentValue(float centerX, float centerY, float posX, fl
|
|
|
|
|
void Engine::DrawSlider(float centerX, float centerY, float value, float minVal, float maxVal, float bottomSideValue, float topSideValue) {
|
|
|
|
|
float barLength = maxVal - minVal;
|
|
|
|
|
|
|
|
|
|
if (value < 0.1f) {
|
|
|
|
|
value = 0.1f;
|
|
|
|
|
if (m_selectedOption == 0) {
|
|
|
|
|
if (value < 0.0f) {
|
|
|
|
|
value = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (value > 1.0f) {
|
|
|
|
|
else {
|
|
|
|
|
if (value < 0.1f) {
|
|
|
|
|
value = 0.1f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (value > 1.0f) {
|
|
|
|
|
value = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2136,13 +2145,14 @@ void Engine::MouseMoveEvent(int x, int y) {
|
|
|
|
|
float normalizedPosition = (x - leftBar) / barLength;
|
|
|
|
|
|
|
|
|
|
if (m_selectedOption == 0 && m_selectedOptAudioMainBar) {
|
|
|
|
|
m_volPrincipal = normalizedPosition;
|
|
|
|
|
m_mainvolume = normalizedPosition;
|
|
|
|
|
}
|
|
|
|
|
else if (m_selectedOption == 0 && m_selectedOptAudioMusicBar) {
|
|
|
|
|
m_volMusique = normalizedPosition;
|
|
|
|
|
m_musicvolume = normalizedPosition;
|
|
|
|
|
m_audio.SetMusicVolume(m_musicvolume);
|
|
|
|
|
}
|
|
|
|
|
else if (m_selectedOption == 0 && m_selectedOptAudioSfxBar) {
|
|
|
|
|
m_volEffets = normalizedPosition;
|
|
|
|
|
m_sfxvolume = normalizedPosition;
|
|
|
|
|
}
|
|
|
|
|
else if (m_selectedOption == 2 && m_selectedGameplaySensitivityBar) {
|
|
|
|
|
m_sensitivity = normalizedPosition;
|
|
|
|
@@ -2276,17 +2286,18 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
|
|
|
|
|
|
|
|
|
if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
|
|
|
|
|
m_audio.playSound(AUDIO_PATH "snap.wav");
|
|
|
|
|
m_volPrincipal = x - leftBar;
|
|
|
|
|
m_mainvolume = normalizedPosition;
|
|
|
|
|
m_selectedOptAudioMainBar = true;
|
|
|
|
|
}
|
|
|
|
|
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarMusique && y < topBarMusique) {
|
|
|
|
|
m_audio.playSound(AUDIO_PATH "snap.wav");
|
|
|
|
|
m_volMusique = x - leftBar;
|
|
|
|
|
m_selectedOptAudioMusicBar = true;
|
|
|
|
|
m_musicvolume = normalizedPosition;
|
|
|
|
|
m_audio.SetMusicVolume(m_musicvolume);
|
|
|
|
|
}
|
|
|
|
|
else if (m_selectedOption == 0 && x > leftBar && x < rightBar && y > bottomBarEffets && y < topBarEffets) {
|
|
|
|
|
m_audio.playSound(AUDIO_PATH "snap.wav");
|
|
|
|
|
m_volEffets = x - leftBar;
|
|
|
|
|
m_sfxvolume = normalizedPosition;
|
|
|
|
|
m_selectedOptAudioSfxBar = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2332,8 +2343,8 @@ 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_audio.playSound(AUDIO_PATH "snap.wav");
|
|
|
|
|
m_sensitivity = normalizedPosition;
|
|
|
|
|
m_selectedGameplaySensitivityBar = true;
|
|
|
|
|
m_sensitivity = normalizedPosition;
|
|
|
|
|
m_player.SetSensitivity(m_sensitivity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -2369,16 +2380,27 @@ void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
|
|
|
|
float rightBar = centerX + Width() * 0.3f;
|
|
|
|
|
float barLength = rightBar - leftBar;
|
|
|
|
|
|
|
|
|
|
float normalizedPosition = (x - leftBar) / barLength;
|
|
|
|
|
|
|
|
|
|
if (normalizedPosition > 1.0f) {
|
|
|
|
|
normalizedPosition = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (button) {
|
|
|
|
|
case MOUSE_BUTTON_LEFT:
|
|
|
|
|
if (m_selectedOptAudioMusicBar) {
|
|
|
|
|
if (normalizedPosition < 0.0f) {
|
|
|
|
|
normalizedPosition = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_musicvolume = normalizedPosition;
|
|
|
|
|
m_audio.SetMusicVolume(m_musicvolume);
|
|
|
|
|
}
|
|
|
|
|
if (m_selectedGameplaySensitivityBar) {
|
|
|
|
|
float normalizedPosition = (x - leftBar) / barLength;
|
|
|
|
|
if (normalizedPosition < 0.1f) {
|
|
|
|
|
normalizedPosition = 0.1f;
|
|
|
|
|
}
|
|
|
|
|
else if (normalizedPosition > 1.0f) {
|
|
|
|
|
normalizedPosition = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_sensitivity = normalizedPosition;
|
|
|
|
|
m_player.SetSensitivity(m_sensitivity);
|
|
|
|
|
}
|
|
|
|
|