Push options resolution fonctionnels.
This commit is contained in:
parent
82bae1c21a
commit
935a977bdf
@ -25,8 +25,8 @@
|
||||
|
||||
#define BULLET_UPDATES_PER_FRAME 20
|
||||
|
||||
#define BASE_WIDTH 640
|
||||
#define BASE_HEIGHT 480
|
||||
#define BASE_WIDTH 1280
|
||||
#define BASE_HEIGHT 720
|
||||
|
||||
|
||||
#define ANIME_PATH_JUMP "./media/textures/AssetOtherPlayer/FinalPNGJumping/"
|
||||
@ -58,7 +58,7 @@ enum Resolution {
|
||||
HD = 0, // 1280x720 (High Definition)
|
||||
FHD, // 1920x1080 (Full HD)
|
||||
QHD, // 2560x1440 (Quad HD)
|
||||
UHD // 3840x2160 (Ultra HD)
|
||||
UHD, // 3840x2160 (Ultra HD)
|
||||
};
|
||||
|
||||
#endif // DEFINE_H__
|
||||
|
@ -2351,21 +2351,23 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
float topChkUHD = centerY + Height() * 0.025f;
|
||||
float bottomChkUHD = centerY;
|
||||
|
||||
if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkHD && y < topChkHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
m_resolution = HD;
|
||||
}
|
||||
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkFHD && y < topChkFHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
m_resolution = FHD;
|
||||
}
|
||||
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkQHD && y < topChkQHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
m_resolution = QHD;
|
||||
}
|
||||
else if (m_selectedOption == 1 && x > leftChk && x < rightChk && y > bottomChkUHD && y < topChkUHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
m_resolution = UHD;
|
||||
if (m_selectedOption == 1) {
|
||||
if (x > leftChk && x < rightChk && y > bottomChkHD && y < topChkHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
ChangeResolution(HD);
|
||||
}
|
||||
else if (x > leftChk && x < rightChk && y > bottomChkFHD && y < topChkFHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
ChangeResolution(FHD);
|
||||
}
|
||||
else if (x > leftChk && x < rightChk && y > bottomChkQHD && y < topChkQHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
ChangeResolution(QHD);
|
||||
}
|
||||
else if (x > leftChk && x < rightChk && y > bottomChkUHD && y < topChkUHD) {
|
||||
m_audio.playSound(AUDIO_PATH "snap.wav", m_sfxvolume);
|
||||
ChangeResolution(UHD);
|
||||
}
|
||||
}
|
||||
|
||||
if (normalizedPosition < 0.1f) {
|
||||
@ -2503,4 +2505,29 @@ bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool use
|
||||
return true;
|
||||
}
|
||||
|
||||
void Engine::ChangeResolution(Resolution resolution) {
|
||||
DeInit();
|
||||
|
||||
switch (resolution) {
|
||||
case HD:
|
||||
OpenglContext::InitWindow(1280, 720);
|
||||
m_resolution = HD;
|
||||
break;
|
||||
case FHD:
|
||||
OpenglContext::InitWindow(1920, 1080);
|
||||
m_resolution = FHD;
|
||||
break;
|
||||
case QHD:
|
||||
OpenglContext::InitWindow(2560, 1440);
|
||||
m_resolution = QHD;
|
||||
break;
|
||||
case UHD:
|
||||
OpenglContext::InitWindow(3840, 2160);
|
||||
m_resolution = UHD;
|
||||
break;
|
||||
}
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,6 +49,7 @@ private:
|
||||
bool StartMultiplayerGame();
|
||||
|
||||
bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true);
|
||||
void ChangeResolution(Resolution resolution);
|
||||
|
||||
void InstantDamage();
|
||||
void SystemNotification(std::string systemLog);
|
||||
|
@ -53,9 +53,9 @@ protected:
|
||||
void ShowCrossCursor() const;
|
||||
|
||||
bool m_istarted = false;
|
||||
void InitWindow(int width, int height);
|
||||
|
||||
private:
|
||||
void InitWindow(int width, int height);
|
||||
MOUSE_BUTTON ConvertMouseButton(sf::Mouse::Button button) const;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user