Activates mouse tracking
This commit is contained in:
@@ -44,6 +44,8 @@ protected:
|
|||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
void wheelEvent(QWheelEvent *event);
|
void wheelEvent(QWheelEvent *event);
|
||||||
|
|
||||||
#ifdef Q_WS_MAEMO_5
|
#ifdef Q_WS_MAEMO_5
|
||||||
@@ -170,6 +172,7 @@ JGEQtRenderer::JGEQtRenderer(QWidget *parent)
|
|||||||
grabZoomKeys(true);
|
grabZoomKeys(true);
|
||||||
#endif
|
#endif
|
||||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
|
setMouseTracking(true);
|
||||||
grabGesture(Qt::PanGesture);
|
grabGesture(Qt::PanGesture);
|
||||||
grabGesture(Qt::PinchGesture);
|
grabGesture(Qt::PinchGesture);
|
||||||
grabGesture(Qt::SwipeGesture);
|
grabGesture(Qt::SwipeGesture);
|
||||||
@@ -297,6 +300,14 @@ void JGEQtRenderer::mouseReleaseEvent(QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void JGEQtRenderer::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
// this is intended to convert window coordinate into game coordinate.
|
||||||
|
// this is correct only if the game and window have the same aspect ratio, otherwise, it's just wrong
|
||||||
|
g_engine->LeftClicked((event->pos().x()*SCREEN_WIDTH)/actualWidth, (event->pos().y()*SCREEN_HEIGHT)/actualHeight);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void JGEQtRenderer::mousePressEvent(QMouseEvent *event)
|
void JGEQtRenderer::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user