summaryrefslogtreecommitdiffstats
path: root/examples/sensors/maze/Mouse.qml
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@qt.io>2023-02-17 12:11:02 +0200
committerJuha Vuolle <juha.vuolle@qt.io>2023-02-22 08:37:51 +0200
commitc908718f86dd409f0f2d3757057d797b2f5ff83a (patch)
tree3efd52b3813890ca337a24c3bce918d971be5e19 /examples/sensors/maze/Mouse.qml
parentb6618e767f69ee3ff3bab8b5b15925ad6fab2b20 (diff)
Remove sensors maze example
The Maze (QML) example is a nice game implementation, but doesn't add much demonstration value in comparison to sensorsshowcase example. The one unique thing it does demonstrate is tilt sensor. Tiltsensor can be added to the sensorsshowcase too; but OTOH tilt is in some sense just 'a' sensor among the sensors, and there is probably no need to use all of them in the examples. Task-number: QTBUG-110939 Pick-to: 6.5 Change-Id: I2fd997750b05b3962428955a2929e149af6b72bd Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'examples/sensors/maze/Mouse.qml')
-rw-r--r--examples/sensors/maze/Mouse.qml45
1 files changed, 0 insertions, 45 deletions
diff --git a/examples/sensors/maze/Mouse.qml b/examples/sensors/maze/Mouse.qml
deleted file mode 100644
index 155f0bd6..00000000
--- a/examples/sensors/maze/Mouse.qml
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-//Import the declarative plugins
-import QtQuick
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-//Implementation of the Mouse control.
-Item {
- id: mouse
- x: 0
- y: 0
- width: Lib.cellDimension
- height: Lib.cellDimension
- property int angle
- readonly property double radians_to_degrees: 180 / Math.PI
-
- AnimatedImage {
- id: img
- source: "content/mouse_down.gif"
- anchors.fill: parent
- visible: true
- }
-
- //Function for moving the mouse
- function move(newx, newy)
- {
- if (mouse.x === newx && mouse.y === newy)
- return
- // somehow this actually works
-//! [0]
- var a = newy - mouse.y
- var b = newx - mouse.x
- angle = Math.atan2(-b, a) * mouse.radians_to_degrees
- if (angle < 0)
- angle = 360 + angle
-
- img.rotation = angle
- mouse.x = newx;
- mouse.y = newy;
-//! [0]
- }
-}