summaryrefslogtreecommitdiffstats
path: root/demos/declarative/samegame/SameGame.qml
diff options
context:
space:
mode:
Diffstat (limited to 'demos/declarative/samegame/SameGame.qml')
-rw-r--r--demos/declarative/samegame/SameGame.qml34
1 files changed, 34 insertions, 0 deletions
diff --git a/demos/declarative/samegame/SameGame.qml b/demos/declarative/samegame/SameGame.qml
new file mode 100644
index 0000000..d476e8b
--- /dev/null
+++ b/demos/declarative/samegame/SameGame.qml
@@ -0,0 +1,34 @@
+import Qt 4.6
+
+import "content"
+
+Rectangle {
+ id: page; width: 460; height: 700; color: activePalette.window
+ Script { source: "content/samegame.js" }
+ SystemPalette { id: activePalette; colorGroup: Qt.Active }
+ Rectangle {
+ id: gameCanvas
+ property int score: 0
+ z:20; y:20; color: "white"; border.width: 1
+ width:parent.width - tileSize - (parent.width % tileSize);
+ height:parent.height - tileSize - (parent.height % tileSize);
+ anchors.horizontalCenter: parent.horizontalCenter
+ Image { id:background;
+ source: "content/pics/background.png"
+ anchors.fill: parent
+ }
+ MouseRegion { id: gameMR
+ anchors.fill: parent; onClicked: handleClick(mouse.x,mouse.y);
+ }
+ }
+
+ Dialog { id: dialog; anchors.centerIn: parent; z: 21}
+ Button {
+ id: btnA; text: "New Game"; onClicked: {initBoard();}
+ anchors.top: gameCanvas.bottom; anchors.topMargin: 4; anchors.left: gameCanvas.left;
+ }
+ Text {
+ text: "Score: " + gameCanvas.score; width:100; font.pointSize:14
+ anchors.top: gameCanvas.bottom; anchors.topMargin: 4; anchors.right: gameCanvas.right;
+ }
+}