summaryrefslogtreecommitdiffstats
path: root/examples/sensors/maze
diff options
context:
space:
mode:
authorWolfgang Beck <wolfgang.beck@nokia.com>2012-05-17 12:27:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-24 03:06:56 +0200
commit17d908ba5205513e9ed0be33aebeb3736bda0326 (patch)
treeda04213540ee61853aab6b4260721f1badd703b2 /examples/sensors/maze
parent32e2d98ea438041e7e0c4df7e67053c5ee7527a7 (diff)
Unfork the examples.
Some examples were forked off and updated. Unfork by bringing these changes back (a later update will bring the other examples in line with this new style). The changes are primarily made up of file renaming. Also, JPG files have been converted to PNG. Some documentation updates have been done. Change-Id: Ib090abb5ebea2003d479d2336a23317f52b8c4d8 Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'examples/sensors/maze')
-rw-r--r--examples/sensors/maze/Congratulation.qml61
-rw-r--r--examples/sensors/maze/LabyrinthSquare.qml80
-rw-r--r--examples/sensors/maze/Maze.qml294
-rw-r--r--examples/sensors/maze/Mouse.qml116
-rw-r--r--examples/sensors/maze/components/ApplicationWindow.qml51
-rw-r--r--examples/sensors/maze/components/Button.qml75
-rw-r--r--examples/sensors/maze/components/images/button_background_disabled.pngbin579 -> 0 bytes
-rw-r--r--examples/sensors/maze/components/images/button_background_normal.pngbin901 -> 0 bytes
-rw-r--r--examples/sensors/maze/components/images/button_background_pressed.pngbin334 -> 0 bytes
-rw-r--r--examples/sensors/maze/icon.pngbin4693 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/00.pngbin186 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/01.pngbin708 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/cheese.pngbin317 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/cheeseeating.gifbin650 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/congratulations.gifbin10811 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_down.gifbin974 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_left.gifbin970 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_leftdown.gifbin976 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_leftup.gifbin976 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_right.gifbin971 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_rightdown.gifbin977 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_rightup.gifbin975 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/mouse_up.gifbin970 -> 0 bytes
-rw-r--r--examples/sensors/maze/images/start.pngbin677 -> 0 bytes
-rw-r--r--examples/sensors/maze/info.json14
-rw-r--r--examples/sensors/maze/lib.js264
-rw-r--r--examples/sensors/maze/maze.pro20
27 files changed, 0 insertions, 975 deletions
diff --git a/examples/sensors/maze/Congratulation.qml b/examples/sensors/maze/Congratulation.qml
deleted file mode 100644
index b08ef1ae..00000000
--- a/examples/sensors/maze/Congratulation.qml
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Import the declarative plugins
-import QtQuick 2.0
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-//Implementation of the Congratulation control
-Item {
- x: Lib.cellDimension
- y: Lib.cellDimension
- width: Lib.cellDimension * (Lib.dimension - 2)
- height: Lib.cellDimension * (Lib.dimension - 2)
-
- //Containing a animated gif image
- AnimatedImage {
- id: img
- anchors.fill: parent
- visible: true
- source: "images/congratulations.gif"
- }
-}
diff --git a/examples/sensors/maze/LabyrinthSquare.qml b/examples/sensors/maze/LabyrinthSquare.qml
deleted file mode 100644
index 27ca84da..00000000
--- a/examples/sensors/maze/LabyrinthSquare.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Import the declarative plugins
-import QtQuick 2.0
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-//Implementation of the Labyrinth square control.
-Rectangle {
- id: sq
- x: 0
- y: 0
- width: Lib.cellDimension
- height: Lib.cellDimension
- color: "white"
- property int val: 0
- property AnimatedImage picture: img
-
- //Dependend of its position and the labyrinth value a square can be the start, cheese, empty or a wall
- AnimatedImage {
- id: img
- anchors.fill: parent
- source: ""
- }
-
- function updateImage()
- {
- if (sq.val == -1)
- sq.picture.source = "images/start.png";
- else if (sq.val == 3)
- sq.picture.source = "images/cheese.png";
- else if (sq.val == 4){
- sq.picture.source = "images/cheeseeating.gif";
- sq.picture.playing = true;
- }
- else if (sq.val == 1)
- sq.picture.source = "images/01.png";
- else
- sq.picture.source = "images/00.png";
- }
-}
diff --git a/examples/sensors/maze/Maze.qml b/examples/sensors/maze/Maze.qml
deleted file mode 100644
index f52c00f2..00000000
--- a/examples/sensors/maze/Maze.qml
+++ /dev/null
@@ -1,294 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/* Layout
- mainWnd
- /
-------------------------------/ gameRect
-| /
-|-----------------------------/
-||---------------------------|
-||||M| ||
-||| \ ||
-||| mouseCtrl ||
-||| ||
-||| ||
-||| Labyrinth ||
-||| ||
-||| ||
-||| cheeseSquare ||
-||| \ ||
-||| |C|||
-||---------------------------|
-|-----------------------------
-|
-|-----------------------------
-|| || |
-|-----------------------------
-| \ \
-| \ timePlayingLabel
-| newGameButton
-------------------------------
-
-*/
-//Import the declarative plugins
-import QtQuick 2.0
-import "components"
-
-//! [0]
-import QtSensors 5.0
-//! [0]
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-ApplicationWindow {
- id: mainWnd
-
- property Mouse mouseCtrl;
- property LabyrinthSquare cheeseSquare;
- property Congratulation congratulation;
-
- Rectangle {
- id: gameRect
- x: (mainWnd.width - width) / 2
- y: 25
- width: Lib.dimension * Lib.cellDimension
- height: Lib.dimension * Lib.cellDimension
- color: "transparent"
- border.width: 2
-
- //timer for starting the labyrinth game
- Timer {
- id: startTimer
- interval: 50; running: true; repeat: false
- onTriggered: {
-
- //reset game time
- timePlayingLabel.text = "--";
- Lib.sec = 0.0;
- Lib.createLabyrinth();
-
- //create labyrinth elements (only at the first time)
- var needloadcomponent = false;
- if (Lib.objectArray === null){
- needloadcomponent = true;
- Lib.objectArray = new Array(Lib.dimension * Lib.dimension);
- }
- var idx = 0;
- for (var y = 0; y < Lib.dimension; y++ ){
- for (var x = 0; x < Lib.dimension; x++ ){
- var component = null;
-
- //create labyrinth components (only at the first time)
- if (needloadcomponent){
- component = Qt.createComponent("LabyrinthSquare.qml");
- if (component.status == Component.Ready) {
- var square = component.createObject(parent);
- square.x = x * square.width;
- square.y = y * square.height;
- square.val = Lib.labyrinth[x][y];
- square.updateImage();
- Lib.objectArray[idx] = square;
- if (x == (Lib.dimension - 1) && y == (Lib.dimension - 1)){
- cheeseSquare = square;
- var component1 = Qt.createComponent("Congratulation.qml");
- if (component1.status == Component.Ready) {
- congratulation = component1.createObject(parent);
- congratulation.visible = false;
- }
- }
- }
- }
- else{
- Lib.objectArray[idx].val = Lib.labyrinth[x][y];
- Lib.objectArray[idx].updateImage();
- if (x == (Lib.dimension - 1) && y == (Lib.dimension - 1)){
- cheeseSquare = Lib.objectArray[idx];
- congratulation.visible = false;
- }
- }
- idx++;
- }
- }
-
- //Lib.printLab(); //this is for debug. Labyrinth will be printed out in the console
-
- //Create the mouse control (only at the first time)
- if (mouseCtrl === null){
- var component = Qt.createComponent("Mouse.qml");
- if (component.status == Component.Ready) {
- mouseCtrl = component.createObject(parent);
- }
- }
- mouseCtrl.x = 0;
- mouseCtrl.y = 0;
- newGameButton.enabled = true;
-
- //Start the Tilt reader timer
- tiltTimer.running = true;
- tiltSensor.calibrate();
- }
- }
- }
-
-//! [1]
- TiltSensor{
- id: tiltSensor
- unit: TiltSensor.Degrees
- enabled: true
- accuracy: 5.0
- }
-//! [1]
-
- //Timer to read out the x and y rotation of the TiltSensor
- Timer {
- id: tiltTimer
- interval: 50; running: false; repeat: true
-
-//! [2]
- onTriggered: {
- if (!tiltSensor.enabled)
- tiltSensor.enabled = true;
-//! [2]
-
- if (mouseCtrl === null)
- return;
-
- //check if already solved
- if (Lib.won !== true){
- Lib.sec += 0.05;
- timePlayingLabel.text = Math.floor(Lib.sec) + " seconds";
-
- //check if we can move the mouse
- var xval = -1;
- var yval = -1;
-
-//! [3]
- var xstep = 0;
- if (tiltSensor.yRotation > 0)
- xstep = 1;
- else if (tiltSensor.yRotation < 0)
- xstep = -1;
- var ystep = 0;
- if (tiltSensor.xRotation > 0)
- ystep = 1;
- else if (tiltSensor.xRotation < 0)
- ystep = -1;
-//! [3]
-
- if (xstep < 0){
- if (mouseCtrl.x > 0){
- if (Lib.canMove(mouseCtrl.x + xstep, mouseCtrl.y)){
- xval = mouseCtrl.x + xstep;
- }
- }
- }
- else if (xstep > 0){
- if (mouseCtrl.x < (Lib.cellDimension * (Lib.dimension - 1))){
- if (Lib.canMove(mouseCtrl.x + xstep, mouseCtrl.y)){
- xval = mouseCtrl.x + xstep;
- }
- }
- }
- if (ystep < 0){
- if (mouseCtrl.y > 0){
- if (Lib.canMove(mouseCtrl.x, mouseCtrl.y + ystep)){
- yval = mouseCtrl.y + ystep;
- }
- }
- }
- else if (ystep > 0){
- if (mouseCtrl.y < (Lib.cellDimension * (Lib.dimension - 1))){
- if (Lib.canMove(mouseCtrl.x, mouseCtrl.y + ystep)){
- yval = mouseCtrl.y + ystep;
- }
- }
- }
- if (xval >= 0 && yval >= 0)
- mouseCtrl.move(xval, yval);
-
- //move the mouse in the allwed position
- else{
- if (xval >= 0){
- mouseCtrl.move(xval, mouseCtrl.y);
- }
- if (yval >= 0){
- mouseCtrl.move(mouseCtrl.x, yval);
- }
- }
- }
- else{
-
- //game won, stop the tilt meter
- mainWnd.cheeseSquare.val = 4;
- mainWnd.cheeseSquare.updateImage();
- mainWnd.congratulation.visible = true;
- newGameButton.enabled = true;
- tiltTimer.running = false;
- }
- }
- }
-
- //Button to start a new Game
- Button{
- id: newGameButton
- anchors.left: gameRect.left
- anchors.top: gameRect.bottom
- anchors.topMargin: 5
- height: 30
- width: 100
- text: "new game"
- enabled: false;
- onClicked: {
- newGameButton.enabled = false;
- startTimer.start();
- }
- }
-
- //Label to print out the game time
- Text{
- id: timePlayingLabel
- anchors.right: gameRect.right
- anchors.top: gameRect.bottom
- anchors.topMargin: 5
- }
-}
-
diff --git a/examples/sensors/maze/Mouse.qml b/examples/sensors/maze/Mouse.qml
deleted file mode 100644
index 9786d96d..00000000
--- a/examples/sensors/maze/Mouse.qml
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Import the declarative plugins
-import QtQuick 2.0
-
-//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
- state: 'right'
-
- AnimatedImage {
- id: img
- anchors.fill: parent
- visible: true
- }
-
- //for different moves we have different gif animations
- states: [
- State {
- name: "up"
- PropertyChanges { target: img; source: "images/mouse_up.gif" }
- },
- State {
- name: "down"
- PropertyChanges { target: img; source: "images/mouse_down.gif" }
- },
- State {
- name: "left"
- PropertyChanges { target: img; source: "images/mouse_left.gif" }
- },
- State {
- name: "right"
- PropertyChanges { target: img; source: "images/mouse_right.gif" }
- },
-
- State {
- name: "rightup"
- PropertyChanges { target: img; source: "images/mouse_rightup.gif" }
- },
- State {
- name: "rightdown"
- PropertyChanges { target: img; source: "images/mouse_rightdown.gif" }
- },
- State {
- name: "leftup"
- PropertyChanges { target: img; source: "images/mouse_leftup.gif" }
- },
- State {
- name: "leftdown"
- PropertyChanges { target: img; source: "images/mouse_leftdown.gif" }
- }
-
- ]
-
- //Function for moving the mouse
- function move(newx, newy)
- {
- var newstatus = "";
- if (mouse.x < newx)
- newstatus += "right";
- else if (mouse.x > newx)
- newstatus += "left";
- if (mouse.y < newy)
- newstatus += "down";
- else if (mouse.y > newy)
- newstatus += "up";
- mouse.state = newstatus;
- mouse.x = newx;
- mouse.y = newy;
- }
-}
diff --git a/examples/sensors/maze/components/ApplicationWindow.qml b/examples/sensors/maze/components/ApplicationWindow.qml
deleted file mode 100644
index cab5e94c..00000000
--- a/examples/sensors/maze/components/ApplicationWindow.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Import the declarative plugins
-import QtQuick 2.0
-
-Rectangle {
- id: appWnd
- x: 0
- y: 0
- width: 320
- height: 480
- color: "#ececec"
-}
diff --git a/examples/sensors/maze/components/Button.qml b/examples/sensors/maze/components/Button.qml
deleted file mode 100644
index 537a8bce..00000000
--- a/examples/sensors/maze/components/Button.qml
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtSensors module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Import the declarative plugins
-import QtQuick 2.0
-
-//Implementation of the Button control.
-Item {
- id: button
- width: 30
- height: 100
- property alias text: innerText.text
- signal clicked
-
- Image {
- id: backgroundImage
- anchors.fill: parent
- source: (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png")
- }
-
- Text {
- id: innerText
- anchors.centerIn: parent
- color: "white"
- font.bold: true
- }
-
- //Mouse area to react on click events
- MouseArea {
- anchors.fill: button
- onClicked: { button.clicked();}
- onPressed: {
- backgroundImage.source = "images/button_background_pressed.png" }
- onReleased: {
- backgroundImage.source = (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png")
- }
- }
-}
diff --git a/examples/sensors/maze/components/images/button_background_disabled.png b/examples/sensors/maze/components/images/button_background_disabled.png
deleted file mode 100644
index 62a00b9a..00000000
--- a/examples/sensors/maze/components/images/button_background_disabled.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/components/images/button_background_normal.png b/examples/sensors/maze/components/images/button_background_normal.png
deleted file mode 100644
index 1fecad5b..00000000
--- a/examples/sensors/maze/components/images/button_background_normal.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/components/images/button_background_pressed.png b/examples/sensors/maze/components/images/button_background_pressed.png
deleted file mode 100644
index 149529e1..00000000
--- a/examples/sensors/maze/components/images/button_background_pressed.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/icon.png b/examples/sensors/maze/icon.png
deleted file mode 100644
index 1e7ff8d8..00000000
--- a/examples/sensors/maze/icon.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/00.png b/examples/sensors/maze/images/00.png
deleted file mode 100644
index ab29a622..00000000
--- a/examples/sensors/maze/images/00.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/01.png b/examples/sensors/maze/images/01.png
deleted file mode 100644
index 0e70d1b2..00000000
--- a/examples/sensors/maze/images/01.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/cheese.png b/examples/sensors/maze/images/cheese.png
deleted file mode 100644
index ecef4503..00000000
--- a/examples/sensors/maze/images/cheese.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/cheeseeating.gif b/examples/sensors/maze/images/cheeseeating.gif
deleted file mode 100644
index 6b2cb47f..00000000
--- a/examples/sensors/maze/images/cheeseeating.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/congratulations.gif b/examples/sensors/maze/images/congratulations.gif
deleted file mode 100644
index 70204176..00000000
--- a/examples/sensors/maze/images/congratulations.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_down.gif b/examples/sensors/maze/images/mouse_down.gif
deleted file mode 100644
index 5491c18f..00000000
--- a/examples/sensors/maze/images/mouse_down.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_left.gif b/examples/sensors/maze/images/mouse_left.gif
deleted file mode 100644
index 265d2bab..00000000
--- a/examples/sensors/maze/images/mouse_left.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_leftdown.gif b/examples/sensors/maze/images/mouse_leftdown.gif
deleted file mode 100644
index bdcd708f..00000000
--- a/examples/sensors/maze/images/mouse_leftdown.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_leftup.gif b/examples/sensors/maze/images/mouse_leftup.gif
deleted file mode 100644
index a8b1e8f6..00000000
--- a/examples/sensors/maze/images/mouse_leftup.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_right.gif b/examples/sensors/maze/images/mouse_right.gif
deleted file mode 100644
index a95d02cc..00000000
--- a/examples/sensors/maze/images/mouse_right.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_rightdown.gif b/examples/sensors/maze/images/mouse_rightdown.gif
deleted file mode 100644
index 00bc3e18..00000000
--- a/examples/sensors/maze/images/mouse_rightdown.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_rightup.gif b/examples/sensors/maze/images/mouse_rightup.gif
deleted file mode 100644
index e0153eb4..00000000
--- a/examples/sensors/maze/images/mouse_rightup.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/mouse_up.gif b/examples/sensors/maze/images/mouse_up.gif
deleted file mode 100644
index 19220ebe..00000000
--- a/examples/sensors/maze/images/mouse_up.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/images/start.png b/examples/sensors/maze/images/start.png
deleted file mode 100644
index 698c0b1c..00000000
--- a/examples/sensors/maze/images/start.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/info.json b/examples/sensors/maze/info.json
deleted file mode 100644
index 3aa2369c..00000000
--- a/examples/sensors/maze/info.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "info-version": "1.0",
- "dict": {
- "Category": "application",
- "Runtime": "qml",
- "DisplayName": "Maze",
- "Subcategory": "utility",
- "MainQML": "Maze.qml",
- "Version": "1.0.0",
- "Identifier": "com.nokia.mt.maze",
- "Summary": "Labyrinth game using TiltSensor",
- "Author": "Qt"
- }
-}
diff --git a/examples/sensors/maze/lib.js b/examples/sensors/maze/lib.js
deleted file mode 100644
index fccce18f..00000000
--- a/examples/sensors/maze/lib.js
+++ /dev/null
@@ -1,264 +0,0 @@
-//global variables
-var labyrinth = null;
-var dimension = 24;
-var cellDimension = 13;
-var won;
-var objectArray = null;
-var sec = 0.0
-
-//Allocate labyrinth arrays and create labyrinth and way reflected in the labyrinth array
-function createLabyrinth()
-{
- won = false;
- //create the labyrinth matrix
- labyrinth = null;
- labyrinth = new Array(dimension);
- for (var x = 0; x < dimension; x++ ){
- labyrinth[x] = new Array(dimension);
- for (var y = 0; y < dimension; y++ ){
- labyrinth[x][y] = 0;
- }
- }
- createWay();
- createLab();
-}
-
-//Create a way where the mouse can reach the cheese
-function createWay()
-{
- //Create rnd way to have at least one solution
- //A way square is marked as a 2 in the labyrinth array
- var x = 0;
- var y = 0;
- var ox = x;
- var oy = y;
- labyrinth[0][0] = 2;
- while (x < dimension && y < dimension){
- var rnd = Math.floor(Math.random()*5);
- if (Math.floor(Math.random()*2) == 1){
- if (rnd == 0) x--;
- if (rnd >= 1) x++;
- if (x < 0) x++;
- if (x >= dimension){
- x = ox;
- break;
- }
- }
- else {
- if (rnd == 0) y--;
- if (rnd >= 1) y++;
- if (y < 0) y++;
- if (y >= dimension){
- y = oy;
- break;
- }
- }
-
- /*avoid to have [2]2|
- |2|2|*/
- if (x < (dimension - 1) && y < (dimension - 1)){
- if (labyrinth[x + 1][y] == 2
- && labyrinth[x][y + 1] == 2
- && labyrinth[x + 1][y + 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
- /*avoid to have |2[2]
- |2|2|*/
- if (x > 0 && y < (dimension - 1)){
- if (labyrinth[x - 1][y] == 2
- && labyrinth[x][y + 1] == 2
- && labyrinth[x - 1][y + 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
- /*avoid to have |2|2|
- [2]2|*/
- if (x < (dimension - 1) && y > 0){
- if (labyrinth[x + 1][y] == 2
- && labyrinth[x][y - 1] == 2
- && labyrinth[x + 1][y - 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
- /*avoid to have |2|2|
- |2[2]*/
- if (x > 0 && y > 0){
- if (labyrinth[x - 1][y] == 2
- && labyrinth[x][y - 1] == 2
- && labyrinth[x - 1][y - 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
-
- labyrinth[x][y] = 2;
- ox = x;
- oy = y;
- }
- //finish way
- while (x < (dimension - 1)){
- labyrinth[x][y] = 2;
- x++;
- }
- while (y < (dimension - 1)){
- labyrinth[x][y] = 2;
- y++;
- }
-}
-
-//Create the labyrinth with rnd values
-function createLab()
-{
- //A wall square is marked as a 1 in the labyrinth array
- //Not a wall square is marked as a 0 in the labyrinth array
- //The Cheese square is marked as a 3 in the labyrinth array
- //The start is marked as a -1 in the labyrinth array
- for (var x = 0; x < dimension; x++ ){
- var rnd = 0;
- for (var y = 0; y < dimension; y++){
- //But don't overwrite the way
- if (labyrinth[x][y] != 2){
- var rnd = Math.floor(Math.random()*2);
- var xy = 0;
- var xxy = 0;
- var xyy = 0;
- var xxyy = 0;
-
- if (x > 0 && y > 0){
- xy = labyrinth[x - 1][y - 1];
- if (xy == 2)
- xy = 0;
-
- xyy = labyrinth[x - 1][y];
- if (xyy == 2)
- xyy = 0;
-
- xxy = labyrinth[x][y - 1];
- if (xxy == 2)
- xxy = 0;
-
- xxyy = rnd;
- if (xxyy == 2)
- xxyy = 0;
-
- //avoid to have to many |0|1| or |1|0| [xy ][xxy ]
- // |1[0] |0[1] [xyy ][xxyy]
- if (xyy == xxy && xy == xxyy && xy != xxy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
-
- //avoid to have to many |1|1| or |0|0|
- // |1[1] |0[0]
- if (xy == xxy && xxy == xxyy && xxyy == xyy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
- }
- else if (x == 0 && y > 0){
- xy = labyrinth[x][y - 1];
- if (xy == 2)
- xy = 0;
-
- xyy = rnd;
- if (xyy == 2)
- xyy = 0;
-
- xxy = labyrinth[x + 1][y - 1];
- if (xxy == 2)
- xxy = 0;
-
- xxyy = labyrinth[x + 1][y];
- if (xxyy == 2)
- xxyy = 0;
-
- //avoid to have to many |1|1| or |0|0|
- // |1[1] |0[0]
- if (xy == xxy && xxy == xxyy && xxyy == xyy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
-
- //avoid to have to many |0|1| or |1|0| [xy ][xxy ]
- // |1[0] |0[1] [xyy ][xxyy]
- if (xyy == xxy && xy == xxyy && xy != xxy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
- }
- labyrinth[x][y] = rnd;
- }
-
- }
- }
- //set start and end
- labyrinth[0][0] = -1;
- labyrinth[0][1] = 0;
- labyrinth[1][0] = 0;
- labyrinth[1][1] = 0;
-
- labyrinth[dimension - 2][dimension - 2] = 0;
- labyrinth[dimension - 2][dimension - 1] = 0;
- labyrinth[dimension - 1][dimension - 2] = 0;
- labyrinth[dimension - 1][dimension - 1] = 3;
-}
-
-//Function that checks if the mouse can be moved in x and y
-function canMove(x, y)
-{
- //Check if movement is allowed
- var xcenter = x + (cellDimension / 2);
- var ycenter = y + (cellDimension / 2);
- //try to get the index
- var idx = Math.floor(xcenter / cellDimension);
- var idy = Math.floor(ycenter / cellDimension);
- var dx = xcenter - (idx * cellDimension + ( cellDimension / 2 ));
- var dy = ycenter - (idy * cellDimension + ( cellDimension / 2 ));
-
- if (dx > 0){
- if (labyrinth[idx + 1][idy] == 1)
- return false;
- }
- if (dx < 0){
- if (labyrinth[idx - 1][idy] == 1)
- return false;
- }
- if (dy > 0){
- if (labyrinth[idx][idy + 1] == 1)
- return false;
- }
- if (dy < 0){
- if (labyrinth[idx][idy - 1] == 1)
- return false;
- }
- //check if won
- if (idx == (dimension - 1) && idy == (dimension - 1))
- won = true;
- return true;
-}
-
-//Function that prints out the labyrith array values in the console
-function printLab()
-{
- //for debug purposes print out lab n console
- var iy = 0;
- for (var y = 0; y < dimension; y++ ){
- var line = "";
- for (var x = 0; x < dimension; x++ ){
- line += labyrinth[x][y];
- }
- console.log(line);
- }
-}
diff --git a/examples/sensors/maze/maze.pro b/examples/sensors/maze/maze.pro
deleted file mode 100644
index cb3b9aaa..00000000
--- a/examples/sensors/maze/maze.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = aux
-
-app.files = \
- Congratulation.qml \
- Maze.qml \
- components \
- images \
- lib.js \
- LabyrinthSquare.qml \
- Mouse.qml \
- icon.png \
- info.json
-
-MT_SYSROOT=$$(MT_SYSROOT)
-!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications
-!isEmpty(EXAMPLES_PREFIX) {
- app.path = $$EXAMPLES_PREFIX/com.nokia.mt.maze
- INSTALLS = app
-}
-