From b1200bcf83536abcaf665b9ee722733e1c4a0361 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 12 Aug 2010 11:46:17 +0200 Subject: Automatically start a game when starting the application. --- animals/memory.js | 4 +--- animals/memory.qml | 15 +++------------ 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'animals') diff --git a/animals/memory.js b/animals/memory.js index b813445..0943190 100644 --- a/animals/memory.js +++ b/animals/memory.js @@ -41,11 +41,10 @@ function createBoard() { } for (var i = 0; i < maxIndex; i++) { - console.log(" create:" + i + ": " + order[i], animals[i][1]); + //console.log(" create:" + i + ": " + order[i], animals[i][1]); var animal = createAnimal(animals[order[i]][1], animals[order[i]][0], i%maxColumn, i%maxRow); } - console.log("board: " + board); } function createAnimal(image, animalId, column, row) { @@ -65,7 +64,6 @@ function createAnimal(image, animalId, column, row) { dynamicObject.y = 5 + row * (gameBoard.blockSize+5); dynamicObject.width = gameBoard.blockSize; dynamicObject.height = gameBoard.blockSize; - //board[index(column, row)] = dynamicObject; } else { console.log("error loading block component"); console.log(component.errorString()); diff --git a/animals/memory.qml b/animals/memory.qml index af0b40a..e70c762 100644 --- a/animals/memory.qml +++ b/animals/memory.qml @@ -4,6 +4,8 @@ import Qt.labs.gestures 1.0 import "memory.js" as MemoryLogic Rectangle { + Component.onCompleted: MemoryLogic.createBoard(); + width: 600 height: 500 @@ -23,18 +25,6 @@ Rectangle { } } - GestureArea { - anchors.fill: parent - Tap { - onStarted: { - if (!gameBoard.started) { - MemoryLogic.createBoard(); - gameBoard.started = true; - } - } - } - } - // last seen front property Animal visibleAnimal; // is the current card the first one @@ -64,3 +54,4 @@ Rectangle { } } + -- cgit v1.2.3