diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-09-27 16:11:50 +0200 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-09-27 18:01:58 +0200 |
commit | d12bf4eb8353f33499cbec4e105431668dbe8c88 (patch) | |
tree | acbe07d64d55ec8da478ad8e10f4a915a17fb86d /examples/embedded/raycasting/raycasting.cpp | |
parent | e24c387413b9707622060f381b2a007aa5c814a0 (diff) |
Port two examples from QTime to QElapsedTimer
Change-Id: I23d13bf1e909801797a8fc2785c46f341ef5ee77
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'examples/embedded/raycasting/raycasting.cpp')
-rw-r--r-- | examples/embedded/raycasting/raycasting.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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; |