From d12bf4eb8353f33499cbec4e105431668dbe8c88 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 27 Sep 2019 16:11:50 +0200 Subject: Port two examples from QTime to QElapsedTimer Change-Id: I23d13bf1e909801797a8fc2785c46f341ef5ee77 Reviewed-by: Christian Ehrlicher --- examples/embedded/raycasting/raycasting.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/embedded/raycasting') diff --git a/examples/embedded/raycasting/raycasting.cpp b/examples/embedded/raycasting/raycasting.cpp index 7213811213..c0a1e48fa6 100644 --- a/examples/embedded/raycasting/raycasting.cpp +++ b/examples/embedded/raycasting/raycasting.cpp @@ -92,7 +92,7 @@ public: } void updatePlayer() { - int interval = qBound(20, watch.elapsed(), 250); + int interval = qBound(20ll, watch.elapsed(), 250ll); watch.start(); angle += angleDelta * interval / 1000; qreal step = moveDelta * interval / 1000; @@ -106,10 +106,10 @@ public: } void showFps() { - static QTime frameTick; + static QElapsedTimer frameTick; static int totalFrame = 0; if (!(totalFrame & 31)) { - int elapsed = frameTick.elapsed(); + const qint64 elapsed = frameTick.elapsed(); frameTick.start(); int fps = 32 * 1000 / (1 + elapsed); setWindowTitle(QString("Raycasting (%1 FPS)").arg(fps)); @@ -355,7 +355,7 @@ protected: } private: - QTime watch; + QElapsedTimer watch; QBasicTimer ticker; QImage buffer; qreal angle; -- cgit v1.2.3