[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmines/viranch/qtquick] src/qml: Prevent mouse actions after game is over
From: Viranch Mehta <viranch.mehta () gmail ! com>
Date: 2013-03-28 11:59:43
Message-ID: 20130328115943.41266A6114 () git ! kde ! org
[Download RAW message or body]
Git commit 7c1e8649e51ea397e053ae2eeaf5e7ee7ddbc688 by Viranch Mehta.
Committed on 08/08/2012 at 15:36.
Pushed by viranch into branch 'viranch/qtquick'.
Prevent mouse actions after game is over
M +2 -0 src/qml/CellItem.qml
M +1 -0 src/qml/logic.js
M +3 -0 src/qml/main.qml
http://commits.kde.org/kmines/7c1e8649e51ea397e053ae2eeaf5e7ee7ddbc688
diff --git a/src/qml/CellItem.qml b/src/qml/CellItem.qml
index 3e46dd3..57635f6 100644
--- a/src/qml/CellItem.qml
+++ b/src/qml/CellItem.qml
@@ -42,11 +42,13 @@ KgCore.CanvasItem {
acceptedButtons: Qt.LeftButton | Qt.RightButton
enabled: !revealed && border==""
onPressed: {
+ if (canvas.game_over) return;
if (mouse.button == Qt.LeftButton && cellState==0) {
cell.pressed = true;
}
}
onReleased: {
+ if (canvas.game_over) return;
cell.pressed = false;
if (mouse.button == Qt.LeftButton) {
if (cellState>0) return;
diff --git a/src/qml/logic.js b/src/qml/logic.js
index a51759a..9dbd816 100644
--- a/src/qml/logic.js
+++ b/src/qml/logic.js
@@ -5,6 +5,7 @@ function reset() {
field.columns = 0;
field.flaggedMines = 0;
firstClick = true;
+ canvas.game_over = false;
}
function revealCell(index) {
diff --git a/src/qml/main.qml b/src/qml/main.qml
index abd4c15..5fed8e3 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.qml
@@ -25,6 +25,9 @@ Item {
signal minesCountChanged(int count, int total)
signal firstClickDone
signal gameOver(bool won)
+ property bool game_over: false
+
+ onGameOver: game_over = true;
property bool useQuestionMarks: true
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic