aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/qtquick1/tutorials/samegame/samegame4
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/qtquick1/tutorials/samegame/samegame4')
-rw-r--r--examples/declarative/qtquick1/tutorials/samegame/samegame4/content/BoomBlock.qml122
-rw-r--r--examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Button.qml81
-rw-r--r--examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Dialog.qml107
-rwxr-xr-xexamples/declarative/qtquick1/tutorials/samegame/samegame4/content/samegame.js225
-rw-r--r--examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/README1
-rwxr-xr-xexamples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_data.xml2
-rwxr-xr-xexamples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_style.xsl28
-rwxr-xr-xexamples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/scores.php31
-rw-r--r--examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame.qml115
-rw-r--r--examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame4.qmlproject16
10 files changed, 0 insertions, 728 deletions
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/BoomBlock.qml
deleted file mode 100644
index c196f23487..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/BoomBlock.qml
+++ /dev/null
@@ -1,122 +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 1.0
-import Qt.labs.particles 1.0
-
-Item {
- id: block
-
- property int type: 0
- property bool dying: false
-
- //![1]
- property bool spawned: false
-
- Behavior on x {
- enabled: spawned;
- SpringAnimation{ spring: 2; damping: 0.2 }
- }
- Behavior on y {
- SpringAnimation{ spring: 2; damping: 0.2 }
- }
- //![1]
-
- //![2]
- Image {
- id: img
-
- anchors.fill: parent
- source: {
- if (type == 0)
- return "../../shared/pics/redStone.png";
- else if (type == 1)
- return "../../shared/pics/blueStone.png";
- else
- return "../../shared/pics/greenStone.png";
- }
- opacity: 0
-
- Behavior on opacity {
- NumberAnimation { properties:"opacity"; duration: 200 }
- }
- }
- //![2]
-
- //![3]
- Particles {
- id: particles
-
- width: 1; height: 1
- anchors.centerIn: parent
-
- emissionRate: 0
- lifeSpan: 700; lifeSpanDeviation: 600
- angle: 0; angleDeviation: 360;
- velocity: 100; velocityDeviation: 30
- source: {
- if (type == 0)
- return "../../shared/pics/redStar.png";
- else if (type == 1)
- return "../../shared/pics/blueStar.png";
- else
- return "../../shared/pics/greenStar.png";
- }
- }
- //![3]
-
- //![4]
- states: [
- State {
- name: "AliveState"
- when: spawned == true && dying == false
- PropertyChanges { target: img; opacity: 1 }
- },
-
- State {
- name: "DeathState"
- when: dying == true
- StateChangeScript { script: particles.burst(50); }
- PropertyChanges { target: img; opacity: 0 }
- StateChangeScript { script: block.destroy(1000); }
- }
- ]
- //![4]
-}
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Button.qml
deleted file mode 100644
index 65880be7ac..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Button.qml
+++ /dev/null
@@ -1,81 +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 1.0
-
-Rectangle {
- id: container
-
- property string text: "Button"
-
- signal clicked
-
- width: buttonLabel.width + 20; height: buttonLabel.height + 5
- border { width: 1; color: Qt.darker(activePalette.button) }
- smooth: true
- radius: 8
-
- // color the button with a gradient
- gradient: Gradient {
- GradientStop {
- position: 0.0
- color: {
- if (mouseArea.pressed)
- return activePalette.dark
- else
- return activePalette.light
- }
- }
- GradientStop { position: 1.0; color: activePalette.button }
- }
-
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: container.clicked();
- }
-
- Text {
- id: buttonLabel
- anchors.centerIn: container
- color: activePalette.buttonText
- text: container.text
- }
-}
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Dialog.qml
deleted file mode 100644
index 01aa3548e9..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/Dialog.qml
+++ /dev/null
@@ -1,107 +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 1.0
-
-//![0]
-Rectangle {
- id: container
-//![0]
-
-//![1]
- property string inputText: textInput.text
- signal closed
-
- function show(text) {
- dialogText.text = text;
- container.opacity = 1;
- textInput.opacity = 0;
- }
-
- function showWithInput(text) {
- show(text);
- textInput.opacity = 1;
- textInput.focus = true;
- textInput.text = ""
- }
-
- function hide() {
- textInput.focus = false;
- container.opacity = 0;
- container.closed();
- }
-//![1]
-
- width: dialogText.width + textInput.width + 20
- height: dialogText.height + 20
- opacity: 0
- visible: opacity > 0
-
- Text {
- id: dialogText
- anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: 10 }
- text: ""
- }
-
-//![2]
- TextInput {
- id: textInput
- anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
- width: 80
- text: ""
-
- onAccepted: container.hide() // close dialog when Enter is pressed
- }
-//![2]
-
- MouseArea {
- anchors.fill: parent
-
- onClicked: {
- if (textInput.text == "" && textInput.opacity > 0)
- textInput.openSoftwareInputPanel();
- else
- hide();
- }
- }
-
-//![3]
-}
-//![3]
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/samegame.js
deleted file mode 100755
index 59ac446452..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/content/samegame.js
+++ /dev/null
@@ -1,225 +0,0 @@
-/* This script file handles the game logic */
-var maxColumn = 10;
-var maxRow = 15;
-var maxIndex = maxColumn * maxRow;
-var board = new Array(maxIndex);
-var component;
-var scoresURL = "";
-var gameDuration;
-
-//Index function used instead of a 2D array
-function index(column, row) {
- return column + (row * maxColumn);
-}
-
-function startNewGame() {
- //Delete blocks from previous game
- for (var i = 0; i < maxIndex; i++) {
- if (board[i] != null)
- board[i].destroy();
- }
-
- //Calculate board size
- maxColumn = Math.floor(gameCanvas.width / gameCanvas.blockSize);
- maxRow = Math.floor(gameCanvas.height / gameCanvas.blockSize);
- maxIndex = maxRow * maxColumn;
-
- //Close dialogs
- nameInputDialog.hide();
- dialog.hide();
-
- //Initialize Board
- board = new Array(maxIndex);
- gameCanvas.score = 0;
- for (var column = 0; column < maxColumn; column++) {
- for (var row = 0; row < maxRow; row++) {
- board[index(column, row)] = null;
- createBlock(column, row);
- }
- }
-
- gameDuration = new Date();
-}
-
-function createBlock(column, row) {
- if (component == null)
- component = Qt.createComponent("content/BoomBlock.qml");
-
- // Note that if Block.qml was not a local file, component.status would be
- // Loading and we should wait for the component's statusChanged() signal to
- // know when the file is downloaded and ready before calling createObject().
- if (component.status == Component.Ready) {
- var dynamicObject = component.createObject(gameCanvas);
- if (dynamicObject == null) {
- console.log("error creating block");
- console.log(component.errorString());
- return false;
- }
- dynamicObject.type = Math.floor(Math.random() * 3);
- dynamicObject.x = column * gameCanvas.blockSize;
- dynamicObject.y = row * gameCanvas.blockSize;
- dynamicObject.width = gameCanvas.blockSize;
- dynamicObject.height = gameCanvas.blockSize;
- dynamicObject.spawned = true;
- board[index(column, row)] = dynamicObject;
- } else {
- console.log("error loading block component");
- console.log(component.errorString());
- return false;
- }
- return true;
-}
-
-var fillFound; //Set after a floodFill call to the number of blocks found
-var floodBoard; //Set to 1 if the floodFill reaches off that node
-
-function handleClick(xPos, yPos) {
- var column = Math.floor(xPos / gameCanvas.blockSize);
- var row = Math.floor(yPos / gameCanvas.blockSize);
- if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
- return;
- if (board[index(column, row)] == null)
- return;
- //If it's a valid block, remove it and all connected (does nothing if it's not connected)
- floodFill(column, row, -1);
- if (fillFound <= 0)
- return;
- gameCanvas.score += (fillFound - 1) * (fillFound - 1);
- shuffleDown();
- victoryCheck();
-}
-
-function floodFill(column, row, type) {
- if (board[index(column, row)] == null)
- return;
- var first = false;
- if (type == -1) {
- first = true;
- type = board[index(column, row)].type;
-
- //Flood fill initialization
- fillFound = 0;
- floodBoard = new Array(maxIndex);
- }
- if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
- return;
- if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type))
- return;
- floodBoard[index(column, row)] = 1;
- floodFill(column + 1, row, type);
- floodFill(column - 1, row, type);
- floodFill(column, row + 1, type);
- floodFill(column, row - 1, type);
- if (first == true && fillFound == 0)
- return; //Can't remove single blocks
- board[index(column, row)].dying = true;
- board[index(column, row)] = null;
- fillFound += 1;
-}
-
-function shuffleDown() {
- //Fall down
- for (var column = 0; column < maxColumn; column++) {
- var fallDist = 0;
- for (var row = maxRow - 1; row >= 0; row--) {
- if (board[index(column, row)] == null) {
- fallDist += 1;
- } else {
- if (fallDist > 0) {
- var obj = board[index(column, row)];
- obj.y = (row + fallDist) * gameCanvas.blockSize;
- board[index(column, row + fallDist)] = obj;
- board[index(column, row)] = null;
- }
- }
- }
- }
- //Fall to the left
- fallDist = 0;
- for (column = 0; column < maxColumn; column++) {
- if (board[index(column, maxRow - 1)] == null) {
- fallDist += 1;
- } else {
- if (fallDist > 0) {
- for (row = 0; row < maxRow; row++) {
- obj = board[index(column, row)];
- if (obj == null)
- continue;
- obj.x = (column - fallDist) * gameCanvas.blockSize;
- board[index(column - fallDist, row)] = obj;
- board[index(column, row)] = null;
- }
- }
- }
- }
-}
-
-//![3]
-function victoryCheck() {
-//![3]
- //Award bonus points if no blocks left
- var deservesBonus = true;
- for (var column = maxColumn - 1; column >= 0; column--)
- if (board[index(column, maxRow - 1)] != null)
- deservesBonus = false;
- if (deservesBonus)
- gameCanvas.score += 500;
-
-//![4]
- //Check whether game has finished
- if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) {
- gameDuration = new Date() - gameDuration;
- nameInputDialog.showWithInput("You won! Please enter your name: ");
- }
-}
-//![4]
-
-//only floods up and right, to see if it can find adjacent same-typed blocks
-function floodMoveCheck(column, row, type) {
- if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
- return false;
- if (board[index(column, row)] == null)
- return false;
- var myType = board[index(column, row)].type;
- if (type == myType)
- return true;
- return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type);
-}
-
-//![2]
-function saveHighScore(name) {
- if (scoresURL != "")
- sendHighScore(name);
-
- var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100);
- var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)";
- var data = [name, gameCanvas.score, maxColumn + "x" + maxRow, Math.floor(gameDuration / 1000)];
- db.transaction(function(tx) {
- tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
- tx.executeSql(dataStr, data);
-
- var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10');
- var r = "\nHIGH SCORES for a standard sized grid\n\n"
- for (var i = 0; i < rs.rows.length; i++) {
- r += (i + 1) + ". " + rs.rows.item(i).name + ' got ' + rs.rows.item(i).score + ' points in ' + rs.rows.item(i).time + ' seconds.\n';
- }
- dialog.show(r);
- });
-}
-//![2]
-
-//![1]
-function sendHighScore(name) {
- var postman = new XMLHttpRequest()
- var postData = "name=" + name + "&score=" + gameCanvas.score + "&gridSize=" + maxColumn + "x" + maxRow + "&time=" + Math.floor(gameDuration / 1000);
- postman.open("POST", scoresURL, true);
- postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- postman.onreadystatechange = function() {
- if (postman.readyState == postman.DONE) {
- dialog.show("Your score has been uploaded.");
- }
- }
- postman.send(postData);
-}
-//![1]
-
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/README b/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/README
deleted file mode 100644
index eaa00fae37..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/README
+++ /dev/null
@@ -1 +0,0 @@
-The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it.
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_data.xml b/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_data.xml
deleted file mode 100755
index c3fd90d9cf..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_data.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-<record><score>1000000</score><name>Alan the Tester</name><gridSize>0x0</gridSize><seconds>0</seconds></record>
-<record><score>6213</score><name>Alan</name><gridSize>12x17</gridSize><seconds>51</seconds></record>
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_style.xsl
deleted file mode 100755
index 670354c965..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/score_style.xsl
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-<xsl:template match="/">
- <html>
- <head><title>SameGame High Scores</title></head>
- <body>
- <h2>SameGame High Scores</h2>
- <table border="1">
- <tr bgcolor="lightsteelblue">
- <th>Name</th>
- <th>Score</th>
- <th>Grid Size</th>
- <th>Time, s</th>
- </tr>
- <xsl:for-each select="records/record">
- <xsl:sort select="score" data-type="number" order="descending"/>
- <tr>
- <td><xsl:value-of select="name"/></td>
- <td><xsl:value-of select="score"/></td>
- <td><xsl:value-of select="gridSize"/></td>
- <td><xsl:value-of select="seconds"/></td>
- </tr>
- </xsl:for-each>
- </table>
- </body>
- </html>
-</xsl:template>
-</xsl:stylesheet>
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/scores.php b/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/scores.php
deleted file mode 100755
index f2ccb8e871..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/highscores/scores.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
- $score = $_POST["score"];
- echo "<html>";
- echo "<head><title>SameGame High Scores</title></head><body>";
- if($score > 0){#Sending in a new high score
- $name = $_POST["name"];
- $grid = $_POST["gridSize"];
- $time = $_POST["time"];
- if($name == "")
- $name = "Anonymous";
- $file = fopen("score_data.xml", "a");
- $ret = fwrite($file, "<record><score>". $score . "</score><name>"
- . $name . "</name><gridSize>" . $grid . "</gridSize><seconds>"
- . $time . "</seconds></record>\n");
- echo "Your score has been recorded. Thanks for playing!";
- if($ret == False)
- echo "<br/> There was an error though, so don't expect to see that score again.";
- }else{#Read high score list
- #Now uses XSLT to display. So just print the file. With XML cruft added.
- #Note that firefox at least won't apply the XSLT on a php file. So redirecting
- $file = fopen("scores.xml", "w");
- $ret = fwrite($file, '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"
- . '<?xml-stylesheet type="text/xsl" href="score_style.xsl"?>' . "\n"
- . "<records>\n" . file_get_contents("score_data.xml") . "</records>\n");
- if($ret == False)
- echo "There was an internal error. Sorry.";
- else
- echo '<script type="text/javascript">window.location.replace("scores.xml")</script>';
- }
- echo "</body></html>";
-?>
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame.qml
deleted file mode 100644
index 60e3f8d0be..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame.qml
+++ /dev/null
@@ -1,115 +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 1.0
-import "content"
-import "content/samegame.js" as SameGame
-
-Rectangle {
- id: screen
-
- width: 490; height: 720
-
- SystemPalette { id: activePalette }
-
- Item {
- width: parent.width
- anchors { top: parent.top; bottom: toolBar.top }
-
- Image {
- id: background
- anchors.fill: parent
- source: "../shared/pics/background.jpg"
- fillMode: Image.PreserveAspectCrop
- }
-
- Item {
- id: gameCanvas
- property int score: 0
- property int blockSize: 40
-
- anchors.centerIn: parent
- width: parent.width - (parent.width % blockSize);
- height: parent.height - (parent.height % blockSize);
-
- MouseArea {
- anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y);
- }
- }
- }
-
- Dialog {
- id: dialog
- anchors.centerIn: parent
- z: 100
- }
-
- //![0]
- Dialog {
- id: nameInputDialog
- anchors.centerIn: parent
- z: 100
-
- onClosed: {
- if (nameInputDialog.inputText != "")
- SameGame.saveHighScore(nameInputDialog.inputText);
- }
- }
- //![0]
-
- Rectangle {
- id: toolBar
- width: parent.width; height: 30
- color: activePalette.window
- anchors.bottom: screen.bottom
-
- Button {
- anchors { left: parent.left; verticalCenter: parent.verticalCenter }
- text: "New Game"
- onClicked: SameGame.startNewGame()
- }
-
- Text {
- id: score
- anchors { right: parent.right; verticalCenter: parent.verticalCenter }
- text: "Score: " + gameCanvas.score
- }
- }
-}
diff --git a/examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame4.qmlproject b/examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame4.qmlproject
deleted file mode 100644
index 42ffacf4f8..0000000000
--- a/examples/declarative/qtquick1/tutorials/samegame/samegame4/samegame4.qmlproject
+++ /dev/null
@@ -1,16 +0,0 @@
-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: "."
- }
-}