diff options
author | Antti Hölttä <AHoelttae@luxoft.com> | 2018-11-13 15:40:13 +0100 |
---|---|---|
committer | Antti Hölttä <AHoelttae@luxoft.com> | 2019-03-18 16:33:53 +0100 |
commit | c9a97de34ca56d4cab671beeeb6d27a66ac3da4e (patch) | |
tree | 652a2fc55284fa22506795eccb2e043aa18446b5 /DemoApplication/pages | |
parent | 67dd94b0daecc445bbd3af7b5956ddcbdbdb5f39 (diff) |
Add 360 algorithm
Add algorithm that allows navigation to any direction. Works somewhat
well now. Example app has a page with a gamepad/stick support.
Diffstat (limited to 'DemoApplication/pages')
-rw-r--r-- | DemoApplication/pages/Page4.qml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/DemoApplication/pages/Page4.qml b/DemoApplication/pages/Page4.qml new file mode 100644 index 0000000..f879d04 --- /dev/null +++ b/DemoApplication/pages/Page4.qml @@ -0,0 +1,80 @@ +import QtQuick 2.0 +import CursorNavigation 1.0 +import QtGamepad 1.0 +import "../controls" + +Item { + CursorNavigation.acceptsCursor: true + + Gamepad { + deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1 + + function handleMove() { + var v = Qt.vector2d(axisLeftX, axisLeftY) + if (v.length() >= 1) { + //console.log("handle joystick move, v=" + v) + parent.CursorNavigation.move(Qt.vector2d(axisLeftX, axisLeftY)) + } + } + + onAxisLeftXChanged: handleMove() + onAxisLeftYChanged: handleMove() + } + + CNButton { + id: cNButton + x: 20 + y: 20 + } + + CNButton { + id: cNButton1 + x: 20 + y: 120 + } + + CNButton { + id: cNButton2 + x: 20 + y: 220 + } + + CNButton { + id: cNButton3 + x: 150 + y: 20 + } + + CNButton { + id: cNButton4 + x: 150 + y: 120 + } + + CNButton { + id: cNButton5 + x: 150 + y: 220 + focus: true + } + + CNButton { + id: cNButton6 + x: 280 + y: 20 + } + + CNButton { + id: cNButton7 + x: 280 + y: 120 + } + + CNButton { + id: cNButton8 + x: 280 + y: 220 + } + +} + |