blob: 1788341e4741164153671890baf2704fa018d5d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import Qt 4.6
import "content"
Rect {
id: page; width: 460; height: 700; color: activePalette.window
Script { source: "content/samegame.js" }
Rect {
id: gameCanvas
property int score: 0
z:20; y:20; width:400; height:600; color: "white"; pen.width: 1
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.centeredIn: 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.size:14
anchors.top: gameCanvas.bottom; anchors.topMargin: 4; anchors.right: gameCanvas.right;
}
Text {
text: "Just over 300 lines of QML/JS code!"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom; anchors.bottomMargin: 16;
opacity: SequentialAnimation{ running: true; repeat: true;
NumberAnimation { from: 0; to: 1; duration: 1000; easing: "easeInQuad" }
NumberAnimation { from: 1; to: 0; duration: 1000; easing: "easeInQuad" }
}
}
}
|