Add new samegame and calculator demos
Change-Id: I06ac38a1d0f844eba367fc5e163151d1f70a0012 Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 80 KiB |
|
@ -1,135 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import QtQuick.Window 2.0
|
||||
import "content"
|
||||
import "content/calculator.js" as CalcEngine
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
|
||||
width: 640; height: 480
|
||||
color: "#282828"
|
||||
|
||||
property string rotateLeft: "\u2939"
|
||||
property string rotateRight: "\u2935"
|
||||
property string leftArrow: "\u2190"
|
||||
property string division : "\u00f7"
|
||||
property string multiplication : "\u00d7"
|
||||
property string squareRoot : "\u221a"
|
||||
property string plusminus : "\u00b1"
|
||||
|
||||
function doOp(operation) { CalcEngine.doOperation(operation) }
|
||||
focus: true
|
||||
Keys.onPressed: doOp(event.text);
|
||||
|
||||
Item {
|
||||
id: main
|
||||
width: 640
|
||||
height: 480
|
||||
anchors.centerIn: parent
|
||||
|
||||
Column {
|
||||
id: box; spacing: 8
|
||||
|
||||
anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 }
|
||||
|
||||
Display {
|
||||
id: display
|
||||
width: box.width-3
|
||||
height: 64
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column; spacing: 6
|
||||
|
||||
property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6)
|
||||
property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
|
||||
|
||||
Row {
|
||||
spacing: 6
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" }
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow }
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: "C" }
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" }
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 6
|
||||
property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
|
||||
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "mc" }
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "m+" }
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "m-" }
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "mr" }
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: grid; rows: 5; columns: 5; spacing: 6
|
||||
|
||||
property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns)
|
||||
|
||||
Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: division }
|
||||
Button { width: grid.w; height: column.h; operation: squareRoot }
|
||||
Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: multiplication }
|
||||
Button { width: grid.w; height: column.h; operation: "x^2" }
|
||||
Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "-" }
|
||||
Button { width: grid.w; height: column.h; operation: "1/x" }
|
||||
Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "." }
|
||||
Button { width: grid.w; height: column.h; operation: plusminus }
|
||||
Button { width: grid.w; height: column.h; operation: "+" }
|
||||
Button { width: grid.w; height: column.h; operation: "="; color: 'red' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import QtQuick.Window 2.0
|
||||
import "content"
|
||||
import "content/calculator.js" as CalcEngine
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
|
||||
width: 320; height: 480
|
||||
color: "#282828"
|
||||
|
||||
property string rotateLeft: "\u2939"
|
||||
property string rotateRight: "\u2935"
|
||||
property string leftArrow: "\u2190"
|
||||
property string division : "\u00f7"
|
||||
property string multiplication : "\u00d7"
|
||||
property string squareRoot : "\u221a"
|
||||
property string plusminus : "\u00b1"
|
||||
|
||||
function doOp(operation) { CalcEngine.doOperation(operation) }
|
||||
|
||||
Item {
|
||||
id: main
|
||||
state: "orientation " + Screen.orientation
|
||||
|
||||
//Note: Assumes a primarily portrait device
|
||||
property bool landscapeWindow: window.width > window.height
|
||||
property real baseWidth: landscapeWindow ? window.height : window.width
|
||||
property real baseHeight: landscapeWindow ? window.width : window.height
|
||||
property real rotationDelta: landscapeWindow ? -90 : 0
|
||||
|
||||
rotation: rotationDelta
|
||||
width: main.baseWidth
|
||||
height: main.baseHeight
|
||||
anchors.centerIn: parent
|
||||
|
||||
Column {
|
||||
id: box; spacing: 8
|
||||
|
||||
anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 }
|
||||
|
||||
Display {
|
||||
id: display
|
||||
width: box.width-3
|
||||
height: 64
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column; spacing: 6
|
||||
|
||||
property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6)
|
||||
property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
|
||||
|
||||
Row {
|
||||
spacing: 6
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" }
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: window.leftArrow }
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: "C" }
|
||||
Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" }
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 6
|
||||
property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
|
||||
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "mc" }
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "m+" }
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "m-" }
|
||||
Button { width: column.w; height: column.h; color: 'green'; operation: "mr" }
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: grid; rows: 5; columns: 5; spacing: 6
|
||||
|
||||
property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns)
|
||||
|
||||
Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: window.division }
|
||||
Button { width: grid.w; height: column.h; operation: window.squareRoot }
|
||||
Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: window.multiplication }
|
||||
Button { width: grid.w; height: column.h; operation: "x^2" }
|
||||
Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "-" }
|
||||
Button { width: grid.w; height: column.h; operation: "1/x" }
|
||||
Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' }
|
||||
Button { width: grid.w; height: column.h; operation: "." }
|
||||
Button { width: grid.w; height: column.h; operation: window.plusminus }
|
||||
Button { width: grid.w; height: column.h; operation: "+" }
|
||||
Button { width: grid.w; height: column.h; operation: "="; color: 'red' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "orientation " + Qt.LandscapeOrientation
|
||||
PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
|
||||
},
|
||||
State {
|
||||
name: "orientation " + Qt.InvertedPortraitOrientation
|
||||
PropertyChanges { target: main; rotation: 180 + rotationDelta; }
|
||||
},
|
||||
State {
|
||||
name: "orientation " + Qt.InvertedLandscapeOrientation
|
||||
PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
|
||||
}
|
||||
]
|
||||
|
||||
transitions: Transition {
|
||||
SequentialAnimation {
|
||||
RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint }
|
||||
NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
TEMPLATE = app
|
||||
|
||||
QT += quick qml
|
||||
SOURCES += main.cpp
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator
|
||||
qml.files = calculator-desktop.qml calculator-mobile.qml content
|
||||
qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator
|
||||
INSTALLS += target qml
|
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 998 B |
|
@ -1,2 +0,0 @@
|
|||
Button Button.qml
|
||||
Display Display.qml
|
|
@ -0,0 +1,9 @@
|
|||
TEMPLATE = app
|
||||
|
||||
QT += qml quick
|
||||
SOURCES += main.cpp
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calqlatr
|
||||
qml.files = calqlatr.qml content
|
||||
qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calqlatr
|
||||
INSTALLS += target qml
|
|
@ -26,12 +26,13 @@
|
|||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\title QML Demo - Calculator
|
||||
\example demos/calculator
|
||||
\brief This is an example calculator application written in QML.
|
||||
\image qml-calculator-example-small.png
|
||||
\title QML Demo - Calqlatr
|
||||
\example demos/calqlatr
|
||||
\brief This is an example calculator written in QML.
|
||||
\image qml-calqlatr-demo-small.png
|
||||
|
||||
The Calculator demo implements a simple calculator in QML. It is written for desktop and portrait devices,
|
||||
although on device it supports orientation changes.
|
||||
This demo implements a simple calculator app, designed for portrait devices.
|
||||
|
||||
This app has the logic implemented in Javascipt and the appearance implemented in QML.
|
||||
*/
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import "content"
|
||||
import "content/calculator.js" as CalcEngine
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: window
|
||||
width: 320
|
||||
height: 480
|
||||
focus: true
|
||||
color: "#272822"
|
||||
|
||||
onWidthChanged: controller.reload()
|
||||
|
||||
function operatorPressed(operator) { CalcEngine.operatorPressed(operator) }
|
||||
function digitPressed(digit) { CalcEngine.digitPressed(digit) }
|
||||
|
||||
Item {
|
||||
id: pad
|
||||
width: window.width * 0.58
|
||||
NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter }
|
||||
}
|
||||
|
||||
AnimationController {
|
||||
id: controller
|
||||
animation: ParallelAnimation {
|
||||
id: anim
|
||||
NumberAnimation { target: display; property: "x"; duration: 400; from: -16; to: window.width - display.width; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation { target: pad; property: "x"; duration: 400; from: window.width - pad.width; to: 0; easing.type: Easing.InOutQuad }
|
||||
SequentialAnimation {
|
||||
NumberAnimation { target: pad; property: "scale"; duration: 200; from: 1; to: 0.97; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation { target: pad; property: "scale"; duration: 200; from: 0.97; to: 1; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Display {
|
||||
id: display
|
||||
x: -16
|
||||
width: window.width * 0.42
|
||||
height: parent.height
|
||||
|
||||
MouseArea {
|
||||
property real startX: 0
|
||||
property real oldP: 0
|
||||
property bool rewind: false
|
||||
|
||||
anchors.fill: parent
|
||||
onPositionChanged: {
|
||||
var reverse = startX > window.width / 2
|
||||
var mx = mapToItem(window, mouse.x).x
|
||||
var p = Math.abs((mx - startX) / (window.width - display.width))
|
||||
if (p < oldP)
|
||||
rewind = reverse ? false : true
|
||||
else
|
||||
rewind = reverse ? true : false
|
||||
controller.progress = reverse ? 1 - p : p
|
||||
oldP = p
|
||||
}
|
||||
onPressed: startX = mapToItem(window, mouse.x).x
|
||||
onReleased: {
|
||||
if (rewind)
|
||||
controller.completeToBeginning()
|
||||
else
|
||||
controller.completeToEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import QmlProject 1.1
|
||||
|
||||
Project {
|
||||
mainFile: "samegame.qml"
|
||||
|
||||
/* Include .qml, .js, and image files from current directory and subdirectories */
|
||||
QmlFiles {
|
||||
directory: "."
|
||||
}
|
||||
JavaScriptFiles {
|
||||
directory: "."
|
||||
}
|
||||
ImageFiles {
|
||||
directory: "."
|
||||
}
|
||||
}
|
|
@ -40,41 +40,41 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
id: page
|
||||
anchors.centerIn: parent
|
||||
Item {
|
||||
property alias text: textItem.text
|
||||
property alias color: textItem.color
|
||||
|
||||
property Item text: dialogText
|
||||
property bool open: false
|
||||
property bool operator: false
|
||||
|
||||
signal closed
|
||||
signal opened
|
||||
function forceClose() {
|
||||
if(!open)
|
||||
return; //already closed
|
||||
page.open = false;
|
||||
page.closed();
|
||||
page.opacity = 0;
|
||||
signal clicked
|
||||
|
||||
width: 30
|
||||
height: 50
|
||||
|
||||
Text {
|
||||
id: textItem
|
||||
font.pixelSize: 48
|
||||
wrapMode: Text.WordWrap
|
||||
lineHeight: 0.75
|
||||
color: "white"
|
||||
}
|
||||
|
||||
function show(txt) {
|
||||
page.open = true;
|
||||
page.opened();
|
||||
dialogText.text = txt;
|
||||
page.opacity = 1;
|
||||
// Rectangle {
|
||||
// color: "red"
|
||||
// opacity: 0.2
|
||||
// anchors.fill: mouse
|
||||
// }
|
||||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
anchors.margins: -5
|
||||
onClicked: {
|
||||
//parent.clicked()
|
||||
if (operator)
|
||||
window.operatorPressed(parent.text)
|
||||
else
|
||||
window.digitPressed(parent.text)
|
||||
}
|
||||
}
|
||||
|
||||
width: dialogText.width + 20; height: dialogText.height + 20
|
||||
color: "white"
|
||||
border.width: 1
|
||||
opacity: 0
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 1000 }
|
||||
}
|
||||
|
||||
Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" }
|
||||
|
||||
MouseArea { anchors.fill: parent; onClicked: forceClose(); }
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
Item {
|
||||
id: display
|
||||
|
||||
function displayOperator(operator)
|
||||
{
|
||||
listView.model.append({ "operator": operator, "operand": "" })
|
||||
}
|
||||
|
||||
function newLine(operator, operand)
|
||||
{
|
||||
listView.model.append({ "operator": operator, "operand": operand })
|
||||
}
|
||||
|
||||
function appendDigit(digit)
|
||||
{
|
||||
if (!listView.model.count)
|
||||
listView.model.append({ "operator": "", "operand": "" })
|
||||
var i = listView.model.count - 1;
|
||||
listView.model.get(i).operand = listView.model.get(i).operand + digit;
|
||||
}
|
||||
|
||||
Item {
|
||||
id: theItem
|
||||
width: parent.width + 32
|
||||
height: parent.height
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
x: 16
|
||||
color: "white"
|
||||
height: parent.height
|
||||
width: display.width - 16
|
||||
}
|
||||
Image {
|
||||
anchors.right: rect.left
|
||||
source: "images/paper-edge-left.png"
|
||||
height: parent.height
|
||||
fillMode: Image.TileVertically
|
||||
}
|
||||
Image {
|
||||
anchors.left: rect.right
|
||||
source: "images/paper-edge-right.png"
|
||||
height: parent.height
|
||||
fillMode: Image.TileVertically
|
||||
}
|
||||
|
||||
Image {
|
||||
source: "images/paper-grip.png"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 20
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
x: 16; y: 30
|
||||
width: display.width
|
||||
height: display.height
|
||||
delegate: Item {
|
||||
height: 20
|
||||
width: parent.width
|
||||
Text {
|
||||
id: operator
|
||||
x: 8
|
||||
font.pixelSize: 18
|
||||
color: "#6da43d"
|
||||
text: model.operator
|
||||
}
|
||||
Text {
|
||||
id: operand
|
||||
font.pixelSize: 18
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 26
|
||||
text: model.operand
|
||||
}
|
||||
}
|
||||
model: ListModel { }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
Grid {
|
||||
columns: 3
|
||||
columnSpacing: 32
|
||||
rowSpacing: 16
|
||||
|
||||
Button { text: "7" }
|
||||
Button { text: "8" }
|
||||
Button { text: "9" }
|
||||
Button { text: "4" }
|
||||
Button { text: "5" }
|
||||
Button { text: "6" }
|
||||
Button { text: "1" }
|
||||
Button { text: "2" }
|
||||
Button { text: "3" }
|
||||
Button { text: "0" }
|
||||
Button { text: "." }
|
||||
Button { text: " " }
|
||||
Button { text: "±"; color: "#6da43d"; operator: true }
|
||||
Button { text: "−"; color: "#6da43d"; operator: true }
|
||||
Button { text: "+"; color: "#6da43d"; operator: true }
|
||||
Button { text: " "; color: "#6da43d"; operator: true }
|
||||
Button { text: "÷"; color: "#6da43d"; operator: true }
|
||||
Button { text: "×"; color: "#6da43d"; operator: true }
|
||||
Button { text: "C"; color: "#6da43d"; operator: true }
|
||||
Button { text: " "; color: "#6da43d"; operator: true }
|
||||
Button { text: "="; color: "#6da43d"; operator: true }
|
||||
}
|
|
@ -38,29 +38,13 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QStringList>
|
||||
#include <QQuickView>
|
||||
#include <QQmlEngine>
|
||||
import QtQuick 2.0
|
||||
|
||||
void usage()
|
||||
{
|
||||
printf("Pass -desktop to use the Desktop UI");
|
||||
exit(0);
|
||||
Text {
|
||||
width: 64
|
||||
font.pixelSize: 14
|
||||
font.bold: false
|
||||
wrapMode: Text.WordWrap
|
||||
lineHeight: 0.75
|
||||
color: "#676764"
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QGuiApplication app(argc,argv);
|
||||
QQuickView view;
|
||||
QUrl launchFile = QUrl::fromLocalFile(QLatin1String("calculator-mobile.qml"));
|
||||
if (app.arguments().contains(QLatin1String("-help")))
|
||||
usage();
|
||||
if (app.arguments().contains(QLatin1String("-desktop")))
|
||||
launchFile = QUrl::fromLocalFile(QLatin1String("calculator-desktop.qml"));
|
||||
view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||
view.setSource(launchFile);
|
||||
view.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -38,97 +38,106 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
var curVal = 0
|
||||
var memory = 0
|
||||
var lastOp = ""
|
||||
var timer = 0
|
||||
var previousOperator = ""
|
||||
var digits = ""
|
||||
|
||||
function disabled(op) {
|
||||
if (op == "." && display.text.toString().search(/\./) != -1) {
|
||||
if (op == "." && digits.toString().search(/\./) != -1) {
|
||||
return true
|
||||
} else if (op == window.squareRoot && display.text.toString().search(/-/) != -1) {
|
||||
} else if (op == window.squareRoot && digits.toString().search(/-/) != -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function doOperation(op) {
|
||||
if (op == '*')//Keyboard Aliases
|
||||
op = window.multiplication;
|
||||
if (op == '/')
|
||||
op = window.division;
|
||||
if (disabled(op)) {
|
||||
function digitPressed(op)
|
||||
{
|
||||
if (disabled(op))
|
||||
return
|
||||
}
|
||||
|
||||
if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) {
|
||||
if (display.text.toString().length >= 14)
|
||||
return; // No arbitrary length numbers
|
||||
if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) {
|
||||
display.text = display.text + op.toString()
|
||||
} else {
|
||||
display.text = op
|
||||
}
|
||||
lastOp = op
|
||||
if (digits.toString().length >= 14)
|
||||
return
|
||||
if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) {
|
||||
digits = digits + op.toString()
|
||||
display.appendDigit(op.toString())
|
||||
} else {
|
||||
digits = op
|
||||
display.appendDigit(op.toString())
|
||||
}
|
||||
lastOp = op
|
||||
}
|
||||
|
||||
if (display.currentOperation.text == "+") {
|
||||
display.text = Number(display.text.valueOf()) + Number(curVal.valueOf())
|
||||
} else if (display.currentOperation.text == "-") {
|
||||
display.text = Number(curVal) - Number(display.text.valueOf())
|
||||
} else if (display.currentOperation.text == window.multiplication) {
|
||||
display.text = Number(curVal) * Number(display.text.valueOf())
|
||||
} else if (display.currentOperation.text == window.division) {
|
||||
display.text = Number(Number(curVal) / Number(display.text.valueOf())).toString()
|
||||
} else if (display.currentOperation.text == "=") {
|
||||
function operatorPressed(op)
|
||||
{
|
||||
if (disabled(op))
|
||||
return
|
||||
lastOp = op
|
||||
|
||||
if (previousOperator == "+") {
|
||||
digits = Number(digits.valueOf()) + Number(curVal.valueOf())
|
||||
} else if (previousOperator == "−") {
|
||||
digits = Number(curVal) - Number(digits.valueOf())
|
||||
} else if (previousOperator == "×") {
|
||||
digits = Number(curVal) * Number(digits.valueOf())
|
||||
} else if (previousOperator == "÷") {
|
||||
digits = Number(Number(curVal) / Number(digits.valueOf())).toString()
|
||||
} else if (previousOperator == "=") {
|
||||
}
|
||||
|
||||
if (op == "+" || op == "-" || op == window.multiplication || op == window.division) {
|
||||
display.currentOperation.text = op
|
||||
curVal = display.text.valueOf()
|
||||
if (op == "+" || op == "−" || op == "×" || op == "÷") {
|
||||
previousOperator = op
|
||||
curVal = digits.valueOf()
|
||||
display.displayOperator(previousOperator)
|
||||
return
|
||||
}
|
||||
|
||||
if (op == "=") {
|
||||
display.newLine("=", digits.toString())
|
||||
}
|
||||
|
||||
curVal = 0
|
||||
display.currentOperation.text = ""
|
||||
previousOperator = ""
|
||||
|
||||
if (op == "1/x") {
|
||||
display.text = (1 / display.text.valueOf()).toString()
|
||||
digits = (1 / digits.valueOf()).toString()
|
||||
} else if (op == "x^2") {
|
||||
display.text = (display.text.valueOf() * display.text.valueOf()).toString()
|
||||
digits = (digits.valueOf() * digits.valueOf()).toString()
|
||||
} else if (op == "Abs") {
|
||||
display.text = (Math.abs(display.text.valueOf())).toString()
|
||||
digits = (Math.abs(digits.valueOf())).toString()
|
||||
} else if (op == "Int") {
|
||||
display.text = (Math.floor(display.text.valueOf())).toString()
|
||||
digits = (Math.floor(digits.valueOf())).toString()
|
||||
} else if (op == window.plusminus) {
|
||||
display.text = (display.text.valueOf() * -1).toString()
|
||||
digits = (digits.valueOf() * -1).toString()
|
||||
} else if (op == window.squareRoot) {
|
||||
display.text = (Math.sqrt(display.text.valueOf())).toString()
|
||||
digits = (Math.sqrt(digits.valueOf())).toString()
|
||||
} else if (op == "mc") {
|
||||
memory = 0;
|
||||
} else if (op == "m+") {
|
||||
memory += display.text.valueOf()
|
||||
memory += digits.valueOf()
|
||||
} else if (op == "mr") {
|
||||
display.text = memory.toString()
|
||||
digits = memory.toString()
|
||||
} else if (op == "m-") {
|
||||
memory = display.text.valueOf()
|
||||
memory = digits.valueOf()
|
||||
} else if (op == window.leftArrow) {
|
||||
display.text = display.text.toString().slice(0, -1)
|
||||
if (display.text.length == 0) {
|
||||
display.text = "0"
|
||||
digits = digits.toString().slice(0, -1)
|
||||
if (digits.length == 0) {
|
||||
digits = "0"
|
||||
}
|
||||
} else if (op == "Off") {
|
||||
Qt.quit();
|
||||
} else if (op == "C") {
|
||||
display.text = "0"
|
||||
digits = "0"
|
||||
} else if (op == "AC") {
|
||||
curVal = 0
|
||||
memory = 0
|
||||
lastOp = ""
|
||||
display.text ="0"
|
||||
digits ="0"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 488 B |
After Width: | Height: | Size: 503 B |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 298 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 4.5 KiB |
|
@ -0,0 +1,41 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "../../shared/shared.h"
|
||||
DECLARATIVE_EXAMPLE_MAIN(calqlatr)
|
|
@ -1,4 +1,4 @@
|
|||
TEMPLATE = subdirs
|
||||
SUBDIRS = calculator \
|
||||
SUBDIRS = calqlatr \
|
||||
samegame \
|
||||
tweetsearch
|
||||
|
|
|
@ -59,40 +59,43 @@ Item {
|
|||
Image {
|
||||
id: img
|
||||
source: {
|
||||
if(type == 0){
|
||||
"pics/redStone.png";
|
||||
} else if(type == 1) {
|
||||
"pics/blueStone.png";
|
||||
if (type == 0){
|
||||
"gfx/red.png";
|
||||
} else if (type == 1) {
|
||||
"gfx/blue.png";
|
||||
} else if (type == 2) {
|
||||
"gfx/green.png";
|
||||
} else {
|
||||
"pics/greenStone.png";
|
||||
"gfx/yellow.png";
|
||||
}
|
||||
}
|
||||
opacity: 0
|
||||
Behavior on opacity { NumberAnimation { duration: 200 } }
|
||||
anchors.fill: parent
|
||||
}
|
||||
Emitter {
|
||||
|
||||
//Foreground particles
|
||||
BlockEmitter {
|
||||
id: particles
|
||||
system: particleSystem
|
||||
group: {
|
||||
if(type == 0){
|
||||
group: {
|
||||
if (type == 0){
|
||||
"red";
|
||||
} else if (type == 1) {
|
||||
"blue";
|
||||
} else {
|
||||
} else if (type == 2) {
|
||||
"green";
|
||||
} else {
|
||||
"yellow";
|
||||
}
|
||||
}
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60}
|
||||
shape: EllipseShape{fill:true}
|
||||
enabled: false;
|
||||
lifeSpan: 700; lifeSpanVariation: 100
|
||||
emitRate: 1000
|
||||
maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number)
|
||||
size: 28
|
||||
endSize: 14
|
||||
//Paint particles on the background
|
||||
PaintEmitter {
|
||||
id: particles2
|
||||
system: particleSystem
|
||||
}
|
||||
|
||||
states: [
|
||||
|
@ -103,7 +106,7 @@ Item {
|
|||
|
||||
State {
|
||||
name: "DeathState"; when: dying == true
|
||||
StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100);} }
|
||||
StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100); particles2.pulse(100);} }
|
||||
PropertyChanges { target: img; opacity: 0 }
|
||||
StateChangeScript { script: block.destroy(1000); }
|
||||
}
|
|
@ -40,43 +40,16 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import "content"
|
||||
import "content/samegame.js" as Logic
|
||||
|
||||
Rectangle {
|
||||
id: screen
|
||||
width: 320; height: 480
|
||||
|
||||
SystemPalette { id: activePalette }
|
||||
|
||||
GameArea {
|
||||
id: gameCanvas
|
||||
width: parent.width
|
||||
blockSize: 40
|
||||
anchors { top: parent.top; bottom: toolBar.top }
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: toolBar
|
||||
width: parent.width; height: 40
|
||||
color: activePalette.window
|
||||
anchors.bottom: screen.bottom
|
||||
|
||||
Button {
|
||||
id: newGameButton
|
||||
anchors { left: parent.left; leftMargin: 12; verticalCenter: parent.verticalCenter }
|
||||
fontSize: 12
|
||||
text: "New Game"
|
||||
onClicked: Logic.startNewGame(gameCanvas)
|
||||
}
|
||||
|
||||
Text {
|
||||
id: score
|
||||
anchors { right: parent.right; rightMargin: 12; verticalCenter: parent.verticalCenter }
|
||||
text: "Score: " + gameCanvas.score
|
||||
font.bold: true
|
||||
font.pixelSize: 12
|
||||
color: activePalette.windowText
|
||||
}
|
||||
}
|
||||
Emitter {
|
||||
property Item block: parent
|
||||
velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -40; magnitudeVariation: 40}
|
||||
acceleration: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -100;}
|
||||
shape: EllipseShape{fill:true}
|
||||
enabled: false;
|
||||
lifeSpan: 700; lifeSpanVariation: 100
|
||||
emitRate: 1000
|
||||
maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number)
|
||||
size: 28
|
||||
endSize: 14
|
||||
}
|
|
@ -39,37 +39,29 @@
|
|||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Rectangle {
|
||||
id: container
|
||||
|
||||
property string text: "Button"
|
||||
property int fontSize: 24
|
||||
|
||||
Item {
|
||||
property alias imgSrc: image.source
|
||||
property alias system: emitter.system
|
||||
property alias group: emitter.group
|
||||
signal clicked
|
||||
|
||||
width: buttonLabel.width + 20; height: buttonLabel.height + 20
|
||||
smooth: true
|
||||
border { width: 1; color: Qt.darker(activePalette.button) }
|
||||
radius: 8
|
||||
color: activePalette.button
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0.0
|
||||
color: {
|
||||
if (mouseArea.pressed)
|
||||
return activePalette.dark
|
||||
else
|
||||
return activePalette.light
|
||||
}
|
||||
property bool rotatedButton: false
|
||||
//Defaults, feel free to override
|
||||
width: image.width
|
||||
height: image.height
|
||||
Image {
|
||||
id: image
|
||||
anchors.centerIn: parent
|
||||
rotation: rotatedButton ? ((Math.random() * 3 + 2) * (Math.random() <= 0.5 ? -1 : 1)) : 0
|
||||
MenuEmitter {
|
||||
id: emitter
|
||||
anchors.fill: parent
|
||||
//shape: MaskShape {source: image.source}
|
||||
}
|
||||
GradientStop { position: 1.0; color: activePalette.button }
|
||||
}
|
||||
|
||||
MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
|
||||
|
||||
Text {
|
||||
id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText; font.pixelSize: container.fontSize
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {parent.clicked(); emitter.burst(400);}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,48 +44,185 @@ import "samegame.js" as Logic
|
|||
|
||||
Item {
|
||||
id: gameCanvas
|
||||
property bool gameOver: true
|
||||
property int score: 0
|
||||
property int blockSize: 40
|
||||
property int highScore: 0
|
||||
property int moves: 0
|
||||
property int blockSize: 32
|
||||
property string mode: ""
|
||||
property ParticleSystem ps: particleSystem
|
||||
//For easy theming
|
||||
property alias backgroundVisible: bg.visible
|
||||
property string background: "gfx/background.png"
|
||||
property string blockFile: "Block.qml"
|
||||
onBlockFileChanged: Logic.changeBlock(blockFile);
|
||||
property alias particlePack: auxLoader.source
|
||||
//For multiplayer
|
||||
property int score2: 0
|
||||
property int curTurn: 1
|
||||
property bool autoTurnChange: false
|
||||
signal swapPlayers
|
||||
property bool swapping: false
|
||||
//onSwapPlayers: if (autoTurnChange) Logic.turnChange();//Now implemented below
|
||||
//For puzzle
|
||||
property url level
|
||||
property bool puzzleWon: false
|
||||
signal puzzleLost //Since root is tracking the puzzle progress
|
||||
function showPuzzleEnd (won) {
|
||||
if (won) {
|
||||
smokeParticle.color = Qt.rgba(0,1,0,0);
|
||||
puzzleWin.play();
|
||||
} else {
|
||||
smokeParticle.color = Qt.rgba(1,0,0,0);
|
||||
puzzleFail.play();
|
||||
puzzleLost();
|
||||
}
|
||||
}
|
||||
function showPuzzleGoal (str) {
|
||||
puzzleTextBubble.opacity = 1;
|
||||
puzzleTextLabel.text = str;
|
||||
}
|
||||
Image {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
id: bg
|
||||
z: -1
|
||||
source: "pics/background.png"
|
||||
source: background;
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
}
|
||||
|
||||
width: 480
|
||||
height: 800
|
||||
width: 320
|
||||
height: 480
|
||||
MouseArea {
|
||||
anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y);
|
||||
anchors.fill: parent; onClicked: {
|
||||
if (puzzleTextBubble.opacity == 1) {
|
||||
puzzleTextBubble.opacity = 0;
|
||||
Logic.finishLoadingMap();
|
||||
} else if (!swapping) {
|
||||
Logic.handleClick(mouse.x,mouse.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
ParticleSystem{
|
||||
|
||||
Image {
|
||||
id: highScoreTextBubble
|
||||
opacity: mode == "arcade" && gameOver && gameCanvas.score == gameCanvas.highScore ? 1 : 0
|
||||
Behavior on opacity { NumberAnimation {} }
|
||||
anchors.centerIn: parent
|
||||
z: 10
|
||||
source: "gfx/bubble-highscore.png"
|
||||
Image {
|
||||
anchors.centerIn: parent
|
||||
source: "gfx/text-highscore-new.png"
|
||||
rotation: -10
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: puzzleTextBubble
|
||||
anchors.centerIn: parent
|
||||
opacity: 0
|
||||
Behavior on opacity { NumberAnimation {} }
|
||||
z: 10
|
||||
source: "gfx/bubble-puzzle.png"
|
||||
Connections {
|
||||
target: gameCanvas
|
||||
onModeChanged: if (mode != "puzzle" && puzzleTextBubble.opacity > 0) puzzleTextBubble.opacity = 0;
|
||||
}
|
||||
Text {
|
||||
id: puzzleTextLabel
|
||||
width: parent.width - 24
|
||||
anchors.centerIn: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
color: "white"
|
||||
font.pixelSize: 24
|
||||
font.bold: true
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
onModeChanged: {
|
||||
p1WonImg.opacity = 0;
|
||||
p2WonImg.opacity = 0;
|
||||
}
|
||||
SmokeText { id: puzzleWin; source: "gfx/icon-ok.png"; system: particleSystem }
|
||||
SmokeText { id: puzzleFail; source: "gfx/icon-fail.png"; system: particleSystem }
|
||||
|
||||
onSwapPlayers: {
|
||||
smokeParticle.color = "yellow"
|
||||
Logic.turnChange();
|
||||
if (curTurn == 1) {
|
||||
p1Text.play();
|
||||
} else {
|
||||
p2Text.play();
|
||||
}
|
||||
clickDelay.running = true;
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: clickDelay
|
||||
ScriptAction { script: gameCanvas.swapping = true; }
|
||||
PauseAnimation { duration: 750 }
|
||||
ScriptAction { script: gameCanvas.swapping = false; }
|
||||
}
|
||||
|
||||
SmokeText {
|
||||
id: p1Text; source: "gfx/text-p1-go.png";
|
||||
system: particleSystem; playerNum: 1
|
||||
opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1
|
||||
}
|
||||
|
||||
SmokeText {
|
||||
id: p2Text; source: "gfx/text-p2-go.png";
|
||||
system: particleSystem; playerNum: 2
|
||||
opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1
|
||||
}
|
||||
|
||||
onGameOverChanged: {
|
||||
if (gameCanvas.mode == "multiplayer") {
|
||||
if (gameCanvas.score >= gameCanvas.score2) {
|
||||
p1WonImg.opacity = 1;
|
||||
} else {
|
||||
p2WonImg.opacity = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Image {
|
||||
id: p1WonImg
|
||||
source: "gfx/text-p1-won.png"
|
||||
anchors.centerIn: parent
|
||||
opacity: 0
|
||||
Behavior on opacity { NumberAnimation {} }
|
||||
z: 10
|
||||
}
|
||||
Image {
|
||||
id: p2WonImg
|
||||
source: "gfx/text-p2-won.png"
|
||||
anchors.centerIn: parent
|
||||
opacity: 0
|
||||
Behavior on opacity { NumberAnimation {} }
|
||||
z: 10
|
||||
}
|
||||
|
||||
ParticleSystem{
|
||||
id: particleSystem;
|
||||
onEmptyChanged: if (empty) paused = true;
|
||||
z:2
|
||||
ImageParticle {
|
||||
groups: ["red"]
|
||||
color: Qt.darker("red");//Actually want desaturated...
|
||||
source: "pics/particle.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["green"]
|
||||
color: Qt.darker("green");//Actually want desaturated...
|
||||
source: "pics/particle.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["blue"]
|
||||
color: Qt.darker("blue");//Actually want desaturated...
|
||||
source: "pics/particle.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
anchors.fill: parent
|
||||
z: 5
|
||||
ImageParticle {
|
||||
id: smokeParticle
|
||||
groups: ["smoke"]
|
||||
source: "gfx/particle-smoke.png"
|
||||
alpha: 0.1
|
||||
alphaVariation: 0.1
|
||||
color: "yellow"
|
||||
}
|
||||
Loader {
|
||||
id: auxLoader
|
||||
anchors.fill: parent
|
||||
source: "PrimaryPack.qml"
|
||||
onItemChanged: {
|
||||
if (item && "particleSystem" in item)
|
||||
item.particleSystem = particleSystem
|
||||
if (item && "gameArea" in item)
|
||||
item.gameArea = gameCanvas
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Item {
|
||||
id: container //Positioned where the 48x48 S/G should be
|
||||
property alias running: mainAnim.running
|
||||
property ParticleSystem particleSystem
|
||||
property int dur: 500
|
||||
signal boomTime
|
||||
Image {
|
||||
id: s1
|
||||
source: "gfx/logo-s.png"
|
||||
y: 0
|
||||
}
|
||||
Image {
|
||||
id: g1
|
||||
source: "gfx/logo-g.png"
|
||||
y: -128
|
||||
}
|
||||
Column {
|
||||
Repeater {
|
||||
model: 2
|
||||
Item {
|
||||
width: 48
|
||||
height: 48
|
||||
BlockEmitter {
|
||||
id: emitter
|
||||
anchors.fill: parent
|
||||
group: "red"
|
||||
system: particleSystem
|
||||
Connections {
|
||||
target: container
|
||||
onBoomTime: emitter.pulse(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: mainAnim
|
||||
running: true
|
||||
loops: -1
|
||||
PropertyAction { target: g1; property: "y"; value: -128}
|
||||
PropertyAction { target: g1; property: "opacity"; value: 1}
|
||||
PropertyAction { target: s1; property: "y"; value: 0}
|
||||
PropertyAction { target: s1; property: "opacity"; value: 1}
|
||||
NumberAnimation { target: g1; property: "y"; from: -96; to: -48; duration: dur}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: g1; property: "y"; from: -48; to: 0; duration: dur}
|
||||
NumberAnimation { target: s1; property: "y"; from: 0; to: 48; duration: dur }
|
||||
}
|
||||
PauseAnimation { duration: dur }
|
||||
ScriptAction { script: container.boomTime(); }
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: g1; property: "opacity"; to: 0; duration: dur }
|
||||
NumberAnimation { target: s1; property: "opacity"; to: 0; duration: dur }
|
||||
}
|
||||
PropertyAction { target: s1; property: "y"; value: -128}
|
||||
PropertyAction { target: s1; property: "opacity"; value: 1}
|
||||
NumberAnimation { target: s1; property: "y"; from: -96; to: 0; duration: dur * 2}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Emitter {
|
||||
anchors.fill: parent
|
||||
velocity: AngleDirection{angleVariation: 360; magnitude: 140; magnitudeVariation: 40}
|
||||
enabled: false;
|
||||
lifeSpan: 500;
|
||||
emitRate: 1
|
||||
size: 28
|
||||
endSize: 14
|
||||
group: "yellow"
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Emitter {
|
||||
property Item block: parent
|
||||
anchors.fill: parent
|
||||
shape: EllipseShape { fill: true }
|
||||
group: {
|
||||
if (block.type == 0){
|
||||
"redspots";
|
||||
} else if (block.type == 1) {
|
||||
"bluespots";
|
||||
} else if (block.type == 2) {
|
||||
"greenspots";
|
||||
} else {
|
||||
"yellowspots";
|
||||
}
|
||||
}
|
||||
size: 64
|
||||
endSize: 16
|
||||
lifeSpan: 30000
|
||||
enabled: false
|
||||
emitRate: 60
|
||||
maximumEmitted: 60
|
||||
velocity: PointDirection{ y: 4; yVariation: 4 }
|
||||
/* Possibly better, but dependent on gerrit change,28212
|
||||
property real mainIntensity: 0.8
|
||||
property real subIntensity: 0.1
|
||||
property real colorVariation: 0.005
|
||||
onEmitParticles: {//One group, many colors, for better stacking
|
||||
for (var i=0; i<particles.length; i++) {
|
||||
var particle = particles[i];
|
||||
if (block.type == 0) {
|
||||
particle.red = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.green = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.blue = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
} else if (block.type == 1) {
|
||||
particle.red = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.green = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.blue = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
} else if (block.type == 2) {
|
||||
particle.red = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.green = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.blue = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
} else if (block.type == 3) {
|
||||
particle.red = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.green = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.blue = subIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
} else {
|
||||
particle.red = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.green = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
particle.blue = mainIntensity + (Math.random() * colorVariation * 2 - colorVariation);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Item {
|
||||
id: container
|
||||
property ParticleSystem particleSystem
|
||||
property GameArea gameArea
|
||||
onGameAreaChanged: bgstacker.parent = gameArea;//Move to direct child of game canvas
|
||||
Item {
|
||||
id: bgstacker
|
||||
z: 0
|
||||
ImageParticle {
|
||||
groups: ["yellowspots"]
|
||||
color: Qt.darker("yellow");//Actually want desaturated...
|
||||
system: particleSystem
|
||||
source: "gfx/particle-paint.png"
|
||||
colorVariation: 0.2
|
||||
alpha: 0.2
|
||||
entryEffect: ImageParticle.None
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["redspots"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("red");//Actually want desaturated...
|
||||
source: "gfx/particle-paint.png"
|
||||
colorVariation: 0.2
|
||||
alpha: 0.2
|
||||
entryEffect: ImageParticle.None
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["greenspots"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("green");//Actually want desaturated...
|
||||
source: "gfx/particle-paint.png"
|
||||
colorVariation: 0.2
|
||||
alpha: 0.2
|
||||
entryEffect: ImageParticle.None
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["bluespots"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("blue");//Actually want desaturated...
|
||||
source: "gfx/particle-paint.png"
|
||||
colorVariation: 0.2
|
||||
alpha: 0.2
|
||||
entryEffect: ImageParticle.None
|
||||
}
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["yellow"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("yellow");//Actually want desaturated...
|
||||
source: "gfx/particle-brick.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["red"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("red");//Actually want desaturated...
|
||||
source: "gfx/particle-brick.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["green"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("green");//Actually want desaturated...
|
||||
source: "gfx/particle-brick.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
ImageParticle {
|
||||
groups: ["blue"]
|
||||
system: particleSystem
|
||||
color: Qt.darker("blue");//Actually want desaturated...
|
||||
source: "gfx/particle-brick.png"
|
||||
colorVariation: 0.4
|
||||
alpha: 0.1
|
||||
}
|
||||
}
|
|
@ -39,45 +39,73 @@
|
|||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
BorderImage {
|
||||
id: button
|
||||
Item {
|
||||
id: block
|
||||
property bool dying: false
|
||||
property bool spawned: false
|
||||
property int type: 0
|
||||
property ParticleSystem particleSystem
|
||||
|
||||
property alias operation: buttonText.text
|
||||
property string color: ""
|
||||
|
||||
Accessible.name: operation
|
||||
Accessible.description: "This button does " + operation
|
||||
Accessible.role: Accessible.Button
|
||||
|
||||
signal clicked
|
||||
|
||||
source: "images/button-" + color + ".png"; clip: true
|
||||
border { left: 10; top: 10; right: 10; bottom: 10 }
|
||||
|
||||
Rectangle {
|
||||
id: shade
|
||||
anchors.fill: button; radius: 10; color: "black"; opacity: 0
|
||||
Behavior on x {
|
||||
enabled: spawned;
|
||||
NumberAnimation{ easing.type: Easing.OutBounce }
|
||||
}
|
||||
Behavior on y {
|
||||
NumberAnimation{ easing.type: Easing.InQuad }
|
||||
}
|
||||
|
||||
Text {
|
||||
id: buttonText
|
||||
anchors.centerIn: parent; anchors.verticalCenterOffset: -1
|
||||
font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5
|
||||
style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
window.doOp(operation)
|
||||
button.clicked()
|
||||
Image {
|
||||
id: img
|
||||
source: {
|
||||
if (type == 0){
|
||||
"gfx/red-puzzle.png";
|
||||
} else if (type == 1) {
|
||||
"gfx/blue-puzzle.png";
|
||||
} else if (type == 2) {
|
||||
"gfx/green-puzzle.png";
|
||||
} else {
|
||||
"gfx/yellow-puzzle.png";
|
||||
}
|
||||
}
|
||||
opacity: 0
|
||||
Behavior on opacity { NumberAnimation { duration: 200 } }
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -4
|
||||
anchors.horizontalCenterOffset: 4
|
||||
}
|
||||
|
||||
states: State {
|
||||
name: "pressed"; when: mouseArea.pressed == true
|
||||
PropertyChanges { target: shade; opacity: .4 }
|
||||
//Foreground particles
|
||||
BlockEmitter {
|
||||
id: particles
|
||||
system: particleSystem
|
||||
group: {
|
||||
if (type == 0){
|
||||
"red";
|
||||
} else if (type == 1) {
|
||||
"blue";
|
||||
} else if (type == 2) {
|
||||
"green";
|
||||
} else {
|
||||
"yellow";
|
||||
}
|
||||
}
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "AliveState"; when: spawned == true && dying == false
|
||||
PropertyChanges { target: img; opacity: 1 }
|
||||
},
|
||||
|
||||
State {
|
||||
name: "DeathState"; when: dying == true
|
||||
PropertyChanges { target: img; scale: 2 }
|
||||
StateChangeScript { script: particles.pulse(200); }
|
||||
PropertyChanges { target: img; opacity: 0 }
|
||||
StateChangeScript { script: block.destroy(1000); }
|
||||
}
|
||||
]
|
||||
}
|
|
@ -37,56 +37,72 @@
|
|||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
|
||||
Dialog {
|
||||
id: nameInputDialog
|
||||
Item {
|
||||
id: block
|
||||
property bool dying: false
|
||||
property bool spawned: false
|
||||
property int type: 0
|
||||
property ParticleSystem particleSystem
|
||||
|
||||
property int initialWidth: 0
|
||||
property alias name: nameInputText.text
|
||||
|
||||
anchors.centerIn: parent
|
||||
z: 22;
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {}
|
||||
enabled: nameInputDialog.initialWidth != 0
|
||||
Behavior on x {
|
||||
enabled: spawned;
|
||||
SpringAnimation{ spring: 2; damping: 0.2 }
|
||||
}
|
||||
Behavior on y {
|
||||
SpringAnimation{ spring: 2; damping: 0.2 }
|
||||
}
|
||||
|
||||
signal accepted(string name)
|
||||
onClosed: {
|
||||
if (nameInputText.text != "")
|
||||
accepted(name);
|
||||
}
|
||||
Text {
|
||||
id: dialogText
|
||||
anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter }
|
||||
text: "You won! Your name: "
|
||||
}
|
||||
MouseArea {
|
||||
Image {
|
||||
id: img
|
||||
source: {
|
||||
if (type == 0){
|
||||
"gfx/red.png";
|
||||
} else if (type == 1) {
|
||||
"gfx/blue.png";
|
||||
} else if (type == 2) {
|
||||
"gfx/green.png";
|
||||
} else {
|
||||
"gfx/yellow.png";
|
||||
}
|
||||
}
|
||||
opacity: 0
|
||||
Behavior on opacity { NumberAnimation { duration: 200 } }
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (nameInputText.text == "")
|
||||
nameInputText.openSoftwareInputPanel();
|
||||
else
|
||||
nameInputDialog.forceClose();
|
||||
}
|
||||
}
|
||||
|
||||
TextInput {
|
||||
id: nameInputText
|
||||
anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
|
||||
focus: visible
|
||||
autoScroll: false
|
||||
maximumLength: 24
|
||||
onTextChanged: {
|
||||
var newWidth = nameInputText.width + dialogText.width + 40;
|
||||
if ( (newWidth > nameInputDialog.width && newWidth < screen.width)
|
||||
|| (nameInputDialog.width > nameInputDialog.initialWidth) )
|
||||
nameInputDialog.width = newWidth;
|
||||
}
|
||||
onAccepted: {
|
||||
nameInputDialog.forceClose();
|
||||
//Foreground particles
|
||||
BlockEmitter {
|
||||
id: particles
|
||||
system: particleSystem
|
||||
group: {
|
||||
if (type == 0){
|
||||
"red";
|
||||
} else if (type == 1) {
|
||||
"blue";
|
||||
} else if (type == 2) {
|
||||
"green";
|
||||
} else {
|
||||
"yellow";
|
||||
}
|
||||
}
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "AliveState"; when: spawned == true && dying == false
|
||||
PropertyChanges { target: img; opacity: 1 }
|
||||
},
|
||||
|
||||
State {
|
||||
name: "DeathState"; when: dying == true
|
||||
StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100); } }
|
||||
PropertyChanges { target: img; opacity: 0 }
|
||||
StateChangeScript { script: block.destroy(1000); }
|
||||
}
|
||||
]
|
||||
}
|
|
@ -40,47 +40,44 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Particles 2.0
|
||||
import "content"
|
||||
import "content/samegame.js" as Logic
|
||||
|
||||
Rectangle {
|
||||
id: screen
|
||||
width: 480; height: 640
|
||||
|
||||
SystemPalette { id: activePalette }
|
||||
|
||||
GameArea {
|
||||
id: gameCanvas
|
||||
width: parent.width
|
||||
anchors { top: parent.top; bottom: toolBar.top }
|
||||
Item {
|
||||
z: 10
|
||||
property alias source: img.source
|
||||
property alias system: emitter.system
|
||||
property int playerNum: 1
|
||||
function play() {
|
||||
anim.running = true;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: toolBar
|
||||
width: parent.width; height: 80
|
||||
color: activePalette.window
|
||||
anchors.bottom: screen.bottom
|
||||
|
||||
Button {
|
||||
id: newGameButton
|
||||
anchors { left: parent.left; leftMargin: 12; verticalCenter: parent.verticalCenter }
|
||||
text: "New Game"
|
||||
onClicked: Logic.startNewGame(gameCanvas)
|
||||
anchors.centerIn: parent
|
||||
Image {
|
||||
opacity: 0
|
||||
id: img
|
||||
anchors.centerIn: parent
|
||||
rotation: playerNum == 1 ? -8 : -5
|
||||
Emitter {
|
||||
id: emitter
|
||||
group: "smoke"
|
||||
anchors.fill: parent
|
||||
shape: MaskShape { source: img.source }
|
||||
enabled: false
|
||||
emitRate: 1000
|
||||
lifeSpan: 600
|
||||
size: 64
|
||||
endSize: 32
|
||||
velocity: AngleDirection { angleVariation: 360; magnitudeVariation: 160 }
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Quit"
|
||||
anchors { left: newGameButton.right; leftMargin: 12; verticalCenter: parent.verticalCenter }
|
||||
onClicked: Qt.quit();
|
||||
}
|
||||
|
||||
Text {
|
||||
id: score
|
||||
anchors { right: parent.right; rightMargin: 12; verticalCenter: parent.verticalCenter }
|
||||
text: "Score: " + gameCanvas.score
|
||||
font.bold: true
|
||||
font.pixelSize: 24
|
||||
color: activePalette.windowText
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: anim
|
||||
running: false
|
||||
PauseAnimation { duration: 500}
|
||||
ParallelAnimation {
|
||||
NumberAnimation { target: img; property: "opacity"; from: 0.1; to: 1.0 }
|
||||
NumberAnimation { target: img; property: "scale"; from: 0.1; to: 1.0 }
|
||||
}
|
||||
PauseAnimation { duration: 250}
|
||||
ScriptAction { script: emitter.pulse(100); }
|
||||
NumberAnimation { target: img; property: "opacity"; from: 1.0; to: 0.0 }
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 861 B After Width: | Height: | Size: 861 B |
After Width: | Height: | Size: 714 B |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1008 B |
|
@ -40,28 +40,31 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
|
||||
BorderImage {
|
||||
id: image
|
||||
Rectangle{
|
||||
id: control
|
||||
property int scoreTarget: -1
|
||||
property int timeTarget: -1
|
||||
property int moveTarget: -1
|
||||
property bool mustClear: true
|
||||
property string goalText: "Clear the level..."
|
||||
|
||||
property alias text : displayText.text
|
||||
property alias currentOperation : operationText
|
||||
property var startingGrid //If this isn't an array of ints, we will refuse to load the level.
|
||||
/* Ints are 0-4. If not enough ints are there it will be prepadded with 0s to fill the grid
|
||||
(which ruins everything if you have the wrong number of rows).
|
||||
0 - No block
|
||||
1 - Red
|
||||
2 - Blue
|
||||
3 - Green
|
||||
4 - Yellow
|
||||
Ideas for future colors, but not supported in this version:
|
||||
5 - Purple
|
||||
6 - Cyan
|
||||
7 - Gray
|
||||
8 - Black
|
||||
9 - White
|
||||
*/
|
||||
|
||||
source: "images/display.png"
|
||||
border { left: 10; top: 10; right: 10; bottom: 10 }
|
||||
|
||||
Text {
|
||||
id: displayText
|
||||
anchors {
|
||||
right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: -1
|
||||
rightMargin: 6; left: operationText.right
|
||||
}
|
||||
font.pixelSize: parent.height * .6; text: "0"; horizontalAlignment: Text.AlignRight; elide: Text.ElideRight
|
||||
color: "#343434"; smooth: true; font.bold: true
|
||||
}
|
||||
Text {
|
||||
id: operationText
|
||||
font.bold: true; font.pixelSize: parent.height * .7
|
||||
color: "#343434"; smooth: true
|
||||
anchors { left: parent.left; leftMargin: 6; verticalCenterOffset: -3; verticalCenter: parent.verticalCenter }
|
||||
}
|
||||
width: 320
|
||||
height: 416
|
||||
color: "white" //TODO: Theme support for both setting themes per level, and seeing it in the control!
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
moveTarget: 3
|
||||
goalText: "1 of 10<br><br>Clear in three moves..."
|
||||
startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 ,
|
||||
0 , 0 , 0 , 0 , 0 , 1 , 1 , 2 , 1 , 1 ,
|
||||
0 , 0 , 0 , 1 , 1 , 3 , 3 , 3 , 3 , 3 ,
|
||||
0 , 1 , 1 , 3 , 3 , 3 , 1 , 3 , 1 , 1 ,
|
||||
1 , 2 , 3 , 3 , 1 , 1 , 3 , 3 , 3 , 3 ,
|
||||
1 , 3 , 3 , 2 , 3 , 3 , 3 , 3 , 1 , 1 ,
|
||||
1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ]
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
timeTarget: 10
|
||||
goalText: "2 of 10<br><br>Clear in 10 seconds..."
|
||||
startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
1 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , 2 ,
|
||||
1 , 2 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 ,
|
||||
2 , 2 , 1 , 3 , 3 , 3 , 1 , 1 , 1 , 2 ,
|
||||
2 , 1 , 1 , 1 , 3 , 3 , 3 , 1 , 2 , 2 ,
|
||||
1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 , 2 , 1 ]
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
scoreTarget: 1200
|
||||
timeTarget: 60
|
||||
goalText: "3 of 10<br><br>Score over 1200 points in one minute..."
|
||||
mustClear: false
|
||||
startingGrid: [ 3 , 1 , 2 , 1 , 1 , 2 , 1 , 1 , 3 , 3 ,
|
||||
1 , 3 , 3 , 2 , 3 , 3 , 1 , 1 , 3 , 1 ,
|
||||
3 , 1 , 3 , 3 , 2 , 3 , 3 , 3 , 1 , 2 ,
|
||||
3 , 2 , 2 , 1 , 3 , 3 , 2 , 1 , 1 , 2 ,
|
||||
3 , 1 , 2 , 2 , 2 , 2 , 2 , 1 , 3 , 1 ,
|
||||
2 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , 3 , 2 ,
|
||||
3 , 2 , 1 , 1 , 3 , 3 , 3 , 2 , 2 , 1 ,
|
||||
1 , 2 , 2 , 3 , 2 , 3 , 3 , 3 , 1 , 1 ,
|
||||
1 , 3 , 3 , 3 , 1 , 2 , 2 , 3 , 3 , 1 ,
|
||||
3 , 3 , 2 , 1 , 2 , 2 , 1 , 1 , 1 , 3 ,
|
||||
2 , 1 , 3 , 2 , 3 , 2 , 3 , 2 , 2 , 1 ,
|
||||
1 , 3 , 1 , 2 , 1 , 2 , 3 , 1 , 2 , 2 ,
|
||||
1 , 2 , 2 , 2 , 1 , 1 , 2 , 3 , 1 , 2 ]
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
scoreTarget: 3000
|
||||
timeTarget: 60
|
||||
goalText: "4 of 10<br>Clear the board with over 3000 points in under a minute..."
|
||||
startingGrid: [ 3 , 3 , 1 , 1 , 1 , 2 , 2 , 4 , 3 , 3 ,
|
||||
4 , 3 , 1 , 4 , 2 , 2 , 2 , 4 , 3 , 4 ,
|
||||
4 , 3 , 3 , 4 , 1 , 1 , 3 , 3 , 4 , 4 ,
|
||||
3 , 3 , 3 , 3 , 3 , 1 , 3 , 2 , 2 , 4 ,
|
||||
4 , 4 , 3 , 4 , 3 , 1 , 4 , 4 , 4 , 4 ,
|
||||
4 , 4 , 3 , 4 , 1 , 1 , 4 , 4 , 3 , 3 ,
|
||||
4 , 2 , 2 , 2 , 2 , 2 , 4 , 4 , 4 , 1 ,
|
||||
4 , 4 , 2 , 4 , 2 , 2 , 1 , 1 , 1 , 1 ,
|
||||
4 , 4 , 2 , 4 , 2 , 2 , 1 , 4 , 4 , 1 ,
|
||||
4 , 1 , 1 , 4 , 3 , 3 , 4 , 2 , 4 , 1 ,
|
||||
4 , 1 , 1 , 2 , 3 , 3 , 4 , 2 , 2 , 1 ,
|
||||
1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 2 , 1 ,
|
||||
4 , 1 , 1 , 2 , 2 , 3 , 4 , 3 , 4 , 4 ]
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
goalText: "5 of 10<br><br>Clear the level..."
|
||||
startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
|
||||
1 , 3 , 2 , 1 , 1 , 1 , 1 , 3 , 2 , 3 ,
|
||||
1 , 2 , 3 , 1 , 3 , 2 , 2 , 1 , 1 , 2 ,
|
||||
3 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 3 , 3 ,
|
||||
2 , 1 , 1 , 3 , 2 , 1 , 1 , 2 , 1 , 3 ,
|
||||
1 , 3 , 3 , 1 , 2 , 1 , 2 , 1 , 3 , 3 ,
|
||||
1 , 3 , 2 , 2 , 2 , 1 , 1 , 3 , 2 , 3 ,
|
||||
1 , 1 , 3 , 2 , 3 , 3 , 2 , 1 , 1 , 1 ,
|
||||
1 , 2 , 2 , 3 , 2 , 2 , 1 , 3 , 1 , 3 ]
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
moveTarget: 4
|
||||
goalText: "6 of 10<br><br>Clear in four or less moves..."
|
||||
startingGrid: [ 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ,
|
||||
4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 ,
|
||||
4 , 2 , 4 , 4 , 4 , 3 , 2 , 3 , 4 , 4 ,
|
||||
4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 ,
|
||||
4 , 4 , 4 , 2 , 4 , 3 , 4 , 3 , 4 , 4 ,
|
||||
4 , 2 , 2 , 2 , 4 , 3 , 4 , 3 , 4 , 4 ,
|
||||
4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ,
|
||||
4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 ,
|
||||
4 , 3 , 3 , 3 , 4 , 2 , 4 , 4 , 4 , 3 ,
|
||||
4 , 3 , 3 , 3 , 4 , 2 , 2 , 2 , 4 , 3 ,
|
||||
4 , 3 , 4 , 3 , 4 , 2 , 4 , 4 , 4 , 4 ,
|
||||
4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 ,
|
||||
4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ]
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
moveTarget: 20
|
||||
timeTarget: 40
|
||||
goalText: "7 of 10<br><br>Clear with 20 moves in 40 seconds (or better)."
|
||||
startingGrid: [ 1 , 3 , 1 , 1 , 1 , 1 , 2 , 1 , 2 , 2 ,
|
||||
2 , 1 , 2 , 3 , 3 , 1 , 3 , 1 , 1 , 3 ,
|
||||
3 , 1 , 1 , 1 , 2 , 2 , 3 , 2 , 3 , 1 ,
|
||||
1 , 3 , 1 , 1 , 3 , 1 , 1 , 1 , 2 , 3 ,
|
||||
2 , 1 , 1 , 1 , 3 , 2 , 3 , 3 , 2 , 3 ,
|
||||
3 , 3 , 3 , 3 , 2 , 2 , 3 , 1 , 3 , 2 ,
|
||||
2 , 2 , 3 , 2 , 2 , 3 , 2 , 2 , 2 , 2 ,
|
||||
1 , 2 , 1 , 2 , 1 , 3 , 2 , 3 , 2 , 3 ,
|
||||
1 , 1 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 2 ,
|
||||
3 , 3 , 2 , 2 , 2 , 2 , 3 , 1 , 3 , 1 ,
|
||||
1 , 2 , 3 , 3 , 3 , 1 , 3 , 2 , 1 , 2 ,
|
||||
1 , 2 , 1 , 1 , 2 , 3 , 1 , 2 , 1 , 3 ,
|
||||
3 , 1 , 2 , 2 , 1 , 3 , 3 , 1 , 3 , 2 ]
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
goalText: "8 of 10<br><br>Clear the grid."
|
||||
startingGrid: [ 2 , 4 , 3 , 2 , 3 , 2 , 3 , 3 , 4 , 3 ,
|
||||
2 , 2 , 3 , 3 , 1 , 4 , 3 , 3 , 3 , 2 ,
|
||||
1 , 4 , 2 , 3 , 4 , 3 , 3 , 1 , 1 , 1 ,
|
||||
2 , 1 , 2 , 4 , 4 , 2 , 2 , 3 , 2 , 1 ,
|
||||
3 , 4 , 4 , 1 , 3 , 2 , 4 , 2 , 1 , 1 ,
|
||||
2 , 2 , 3 , 1 , 2 , 4 , 1 , 2 , 1 , 2 ,
|
||||
1 , 2 , 3 , 2 , 4 , 4 , 3 , 1 , 1 , 2 ,
|
||||
4 , 4 , 2 , 1 , 2 , 4 , 2 , 2 , 4 , 3 ,
|
||||
4 , 2 , 4 , 1 , 3 , 4 , 1 , 4 , 2 , 4 ,
|
||||
4 , 3 , 4 , 1 , 4 , 3 , 1 , 3 , 1 , 1 ,
|
||||
3 , 3 , 2 , 3 , 2 , 4 , 1 , 2 , 4 , 4 ,
|
||||
3 , 4 , 2 , 2 , 4 , 3 , 4 , 1 , 3 , 2 ,
|
||||
4 , 3 , 3 , 4 , 2 , 4 , 1 , 2 , 3 , 2 ]
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
scoreTarget: 1000
|
||||
goalText: "9 of 10<br><br>Score over 1000 points"
|
||||
startingGrid: [ 1 , 4 , 4 , 3 , 2 , 1 , 4 , 2 , 4 , 2 ,
|
||||
2 , 3 , 4 , 4 , 1 , 1 , 1 , 4 , 4 , 4 ,
|
||||
1 , 3 , 1 , 2 , 2 , 1 , 2 , 1 , 4 , 2 ,
|
||||
4 , 3 , 4 , 2 , 1 , 4 , 1 , 2 , 2 , 3 ,
|
||||
3 , 4 , 2 , 4 , 4 , 3 , 2 , 2 , 2 , 1 ,
|
||||
4 , 4 , 3 , 2 , 4 , 4 , 2 , 1 , 1 , 1 ,
|
||||
1 , 2 , 1 , 3 , 4 , 1 , 1 , 3 , 2 , 3 ,
|
||||
3 , 4 , 2 , 2 , 1 , 3 , 2 , 2 , 4 , 2 ,
|
||||
2 , 4 , 1 , 2 , 2 , 4 , 3 , 3 , 3 , 1 ,
|
||||
1 , 2 , 2 , 4 , 1 , 2 , 2 , 3 , 3 , 3 ,
|
||||
4 , 4 , 1 , 4 , 3 , 1 , 3 , 3 , 3 , 4 ,
|
||||
1 , 2 , 4 , 1 , 2 , 1 , 1 , 4 , 2 , 1 ,
|
||||
1 , 2 , 3 , 4 , 2 , 4 , 4 , 2 , 1 , 3 ]
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the examples 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 QtQuick 2.0
|
||||
|
||||
TemplateBase{
|
||||
scoreTarget: 2000
|
||||
timeTarget: 60
|
||||
moveTarget: 20
|
||||
mustClear: false
|
||||
goalText: "10 of 10<br><br>Score 2000 in one minute with less than 20 moves!"
|
||||
startingGrid: [ 3 , 2 , 3 , 1 , 3 , 3 , 4 , 1 , 3 , 3 ,
|
||||
2 , 3 , 2 , 1 , 1 , 2 , 2 , 2 , 4 , 1 ,
|
||||
2 , 4 , 4 , 4 , 3 , 1 , 4 , 4 , 4 , 1 ,
|
||||
3 , 1 , 3 , 4 , 4 , 2 , 2 , 2 , 2 , 3 ,
|
||||
2 , 1 , 4 , 4 , 3 , 3 , 1 , 1 , 3 , 2 ,
|
||||
3 , 2 , 1 , 4 , 3 , 4 , 1 , 3 , 4 , 2 ,
|
||||
3 , 3 , 1 , 4 , 4 , 4 , 2 , 1 , 2 , 3 ,
|
||||
2 , 3 , 4 , 3 , 4 , 1 , 1 , 3 , 2 , 4 ,
|
||||
4 , 4 , 1 , 2 , 4 , 3 , 2 , 2 , 2 , 4 ,
|
||||
1 , 4 , 2 , 2 , 1 , 1 , 2 , 1 , 1 , 4 ,
|
||||
1 , 4 , 3 , 3 , 3 , 1 , 3 , 4 , 4 , 2 ,
|
||||
3 , 4 , 1 , 1 , 2 , 2 , 2 , 3 , 2 , 1 ,
|
||||
3 , 3 , 4 , 3 , 1 , 1 , 1 , 4 , 4 , 3 ]
|
||||
}
|
Before Width: | Height: | Size: 307 KiB |