diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-09-13 10:34:33 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-09-17 08:19:52 +0300 |
commit | ab63bfa4efda42bbbf0fdca486911fec1817acc6 (patch) | |
tree | 3dca665062a4e80678e98068c97d54b8cc1f8994 /examples | |
parent | 007dcbf074a9e4d72e2a29a4a28ac5e502830e20 (diff) |
Remove float => double truncation compilation warning on MSVC
Explicitly declare numbers stored to floats as floats
Pick-to: 6.2
Change-Id: Id1e9d5a5e393dbad0c0fec7aac3083d6e62403cc
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/bluetooth/pingpong/pingpong.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/bluetooth/pingpong/pingpong.cpp b/examples/bluetooth/pingpong/pingpong.cpp index 70992036..b6e6196c 100644 --- a/examples/bluetooth/pingpong/pingpong.cpp +++ b/examples/bluetooth/pingpong/pingpong.cpp @@ -125,9 +125,9 @@ void PingPong::updateRightBlock(const float &rY) void PingPong::checkBoundaries() { - float ballWidth = 1. / 27; - float blockSize = 1. / 27; - float blockHeight = 1. / 5; + float ballWidth = 1.f / 27; + float blockSize = 1.f / 27; + float blockHeight = 1.f / 5; float ballCenterY = m_ballY + ballWidth / 2.; //! [Checking the boundaries] @@ -195,8 +195,8 @@ void PingPong::checkBoundaries() //! [Checking the boundaries] else if ((m_ballX + ballWidth) > 1.f) { m_resultLeft++; - m_speedx = -0.002; - m_speedy = -0.002; + m_speedx = -0.002f; + m_speedy = -0.002f; m_ballX = 0.5f; m_ballY = 0.9f; @@ -215,8 +215,8 @@ void PingPong::checkBoundaries() emit resultChanged(); } else if (m_ballX < 0) { m_resultRight++; - m_speedx = 0.002; - m_speedy = -0.002; + m_speedx = 0.002f; + m_speedy = -0.002f; m_ballX = 0.5f; m_ballY = 0.9f; |