Push sensibilite souris fonctionnelle.
This commit is contained in:
parent
6ba316aa2d
commit
0b4546eee9
@ -2307,10 +2307,18 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
m_resolution = UHD;
|
||||
}
|
||||
|
||||
if (normalizedPosition < 0.1f) {
|
||||
normalizedPosition = 0.1f;
|
||||
}
|
||||
else if (normalizedPosition > 1.0f) {
|
||||
normalizedPosition = 1.0f;
|
||||
}
|
||||
// Gameplay
|
||||
if (m_selectedOption == 2 && x > leftBar && x < rightBar && y > bottomBarPrincipal && y < topBarPrincipal) {
|
||||
m_sensitivity = normalizedPosition;
|
||||
std::cout << "Sensitivity PRESS: " << m_sensitivity << std::endl;
|
||||
m_selectedGameplaySensitivityBar = true;
|
||||
m_player.SetSensitivity(m_sensitivity);
|
||||
}
|
||||
}
|
||||
else if (m_gamestate == GameState::PAUSE) {
|
||||
@ -2336,8 +2344,26 @@ void Engine::MousePressEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
}
|
||||
|
||||
void Engine::MouseReleaseEvent(const MOUSE_BUTTON& button, int x, int y) {
|
||||
float centerX = Width() * 0.5f;
|
||||
float centerY = Height() * 0.5f;
|
||||
float leftBar = centerX - Width() * 0.15f;
|
||||
float rightBar = centerX + Width() * 0.3f;
|
||||
float barLength = rightBar - leftBar;
|
||||
|
||||
switch (button) {
|
||||
case MOUSE_BUTTON_LEFT:
|
||||
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;
|
||||
std::cout << "Sensitivity RELEASE: " << m_sensitivity << std::endl;
|
||||
m_player.SetSensitivity(m_sensitivity);
|
||||
}
|
||||
m_mouseL = false;
|
||||
m_block = false;
|
||||
m_selectedOptAudioMainBar = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user