VideoCommon: Change free-look's middle-mouse action to roll the camera.

This commit is contained in:
Jordan Woyak
2019-03-09 10:25:41 -06:00
parent 5c5e6df038
commit 779e618046
6 changed files with 28 additions and 61 deletions

View File

@ -191,7 +191,7 @@ void AdvancedWidget::AddDescriptions()
#endif
static const char TR_FREE_LOOK_DESCRIPTION[] = QT_TR_NOOP(
"Allows manipulation of the in-game camera. Move the mouse while holding the right button "
"to pan or middle button to move.\n\nUse the WASD keys while holding SHIFT to move the "
"to pan or middle button to roll.\n\nUse the WASD keys while holding SHIFT to move the "
"camera. Press SHIFT+2 to increase speed or SHIFT+1 to decrease speed. Press SHIFT+R "
"to reset the camera or SHIFT+F to reset the speed.\n\nIf unsure, leave this unchecked. ");
static const char TR_CROPPING_DESCRIPTION[] =

View File

@ -235,21 +235,19 @@ bool RenderWidget::event(QEvent* event)
void RenderWidget::OnFreeLookMouseMove(QMouseEvent* event)
{
if (event->buttons() & Qt::MidButton)
{
// Mouse Move
VertexShaderManager::TranslateView((event->x() - m_last_mouse[0]) / 50.0f,
(event->y() - m_last_mouse[1]) / 50.0f);
}
else if (event->buttons() & Qt::RightButton)
{
// Mouse Look
VertexShaderManager::RotateView((event->x() - m_last_mouse[0]) / 200.0f,
(event->y() - m_last_mouse[1]) / 200.0f);
}
const auto mouse_move = event->pos() - m_last_mouse;
m_last_mouse = event->pos();
m_last_mouse[0] = event->x();
m_last_mouse[1] = event->y();
if (event->buttons() & Qt::RightButton)
{
// Camera Pitch and Yaw:
VertexShaderManager::RotateView(mouse_move.y() / 200.f, mouse_move.x() / 200.f, 0.f);
}
else if (event->buttons() & Qt::MidButton)
{
// Camera Roll:
VertexShaderManager::RotateView(0.f, 0.f, mouse_move.x() / 200.f);
}
}
void RenderWidget::PassEventToImGui(const QEvent* event)

View File

@ -4,8 +4,6 @@
#pragma once
#include <array>
#include <QEvent>
#include <QWidget>
@ -43,5 +41,5 @@ private:
static constexpr int MOUSE_HIDE_DELAY = 3000;
QTimer* m_mouse_timer;
std::array<float, 2> m_last_mouse{};
QPoint m_last_mouse{};
};