Commit Graph

9 Commits

Author SHA1 Message Date
Soheil Armin 4712e40925 Dice: Replace SoundEffect with MediaPlayer
Although the SoundEffect type has lower latency, it is
more resource intensive and shows lower performance and
makes the UI stuttering in some desktop or mobile target
devices.

In this change, we replace SoundEffect with MediaPlayer to
get better visual performance.

Pick-to: 6.8 6.9 6.9.0
Change-Id: Ib5f4d8fe6efb726e341481af9a3aaf2d1f4f1515
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-24 09:12:59 +00:00
Soheil Armin 015e19ce0d Dice: Replace forEach() with reduce() to calculate dice sound volume
Pick-to: 6.8 6.9 6.9.0
Change-Id: I1411176d718d5219a42a12c4334d8d6d89b88a8a
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-03-20 18:51:49 +02:00
Soheil Armin 65937d3bc8 Dice: Improve atRest property of PhysicalDie
atRest property should be true while the motionTimeout timer
is running.

This change remove a function binding and directly aliases the
atRest property to running property of the timer.

TODO: atRest is unused based on a previous change. If we decide
to keep the logic in the previous patch, then we can remove
this timer and also the property.

Pick-to: 6.8 6.9 6.9.0
Change-Id: I9d0c58f192251621cb3e691cf431366eb6b1dd68
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2025-03-20 18:51:46 +02:00
Assam Boudjelthia 7668e5a746 Android: optimize dice app for mobile orientation
Now, the camera position is set too close so that not the whole view
is shown on portrait mode. So set the camera position close or far based
on the orientation.

Increase the default size of the dice so it's more visible and not tiny.

Don't move/shift the whole scene when the drawer is opened, this just
causes huge drop in fps on Android devices, instead the drawer opens
without affecting the scene's postion or dimentions.

Pick-to: 6.8
Task-number: QTBUG-127813
Change-Id: I3c7c54e4a1dbb3378045d86debaa21c8e50e8e94
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-09-26 15:39:24 +03:00
Jonas Karlsson 8b4248d687 Dice example: adapt to Qt 6.8 shadow mapping
The dice shadows are now only enabled when they are close enough to the
table. This will keep shadow map bounds smaller and reduce graphical
artifacts.

Pick-to: 6.8
Change-Id: I4664e4d6d825f0dd01ebb65e1180cb28155cb890
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-08-22 09:11:29 +02:00
Sami Shalayel c4d3c1690a dice demo: use qt_add_qml_module
Use qt_add_qml_module for the dice demo.

Make the demo qmllint clean by removing unused imports, unqualified
accesses and more.

Use loadFromModule instead of load, and rename main.qml to Main.qml to
be loadable. Also add a missing qmldir file for the qmake project to
work with loadFromModule, and fix the prefixes in the .pro file.

Pick-to: 6.8
Task-number: QTBUG-100100
Change-Id: I786dcb971980f48e91b0aeaf9d65f285a78c260e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-07-09 08:57:19 +02:00
Jonas Karlsson 7b243c46f3 Dice example: fix deprecated warning
"Injection of parameters into signal handlers is deprecated"

Change-Id: I12f6257b4cf2f5b79d9ba7153ad256292eebc0fd
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-01-26 19:57:58 +01:00
Nicholas Bennett 62b33327c0 Dice Demo: Add sound effects and shake to roll
Added the features in line with the spike outcome.
In addition, I modified the spawnDice function to
estimate if all dice are at rest before enabling spawning.
This prevents duplicate shake events and double tap
fumbles.

Task-number: QTBUG-116491
Pick-to: 6.6
Change-Id: Ia0dc59e469e008da5fc3afe2a7342381eadc1008
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-09-02 03:40:04 +00:00
Jonas Karlsson 34ecd60038 Add the 'dice' example
Fixes: QTBUG-113600
Pick-to: 6.5 6.5.2 6.6
Change-Id: I13b8327f2dcf3e7eaec80c7c10038b22a1656df3
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-21 00:50:04 +02:00