diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2009-10-08 05:51:53 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2009-10-08 05:51:53 (GMT) |
commit | 658f78e2fec95faf1d4c2a066b41bd092d811915 (patch) | |
tree | d41299f77e60d6e8cc6448c20432b7e5ab24a1bb /doc/src/declarative/advtutorial3.qdoc | |
parent | ca6ec0bd63a8772ceaf947ca25258ef45f58fa60 (diff) | |
parent | f36619d24bc1a2b1e9bef6b4fac7d5d9a1916b7c (diff) | |
download | Qt-658f78e2fec95faf1d4c2a066b41bd092d811915.zip Qt-658f78e2fec95faf1d4c2a066b41bd092d811915.tar.gz Qt-658f78e2fec95faf1d4c2a066b41bd092d811915.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
doc/src/declarative/advtutorial1.qdoc
doc/src/declarative/advtutorial3.qdoc
doc/src/declarative/advtutorial4.qdoc
Diffstat (limited to 'doc/src/declarative/advtutorial3.qdoc')
-rw-r--r-- | doc/src/declarative/advtutorial3.qdoc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/doc/src/declarative/advtutorial3.qdoc b/doc/src/declarative/advtutorial3.qdoc index 841e150..ea504aa 100644 --- a/doc/src/declarative/advtutorial3.qdoc +++ b/doc/src/declarative/advtutorial3.qdoc @@ -41,12 +41,12 @@ /*! \page advtutorial3.html -\title Advanced Tutorial 3 - Implementing the Game Logic \target advtutorial3 +\title Advanced Tutorial 3 - Implementing the Game Logic -To the initBoard function we added clearing the board before hand, so that clicking new game won't leave the previous -game lying around in the background. To the createComponent function we have added setting the type of the block to a -number between one and three - it's fundamental to the game logic that the blocks be different types if you want a fun game. +To the \c initBoard function we added clearing the board beforehand, so that clicking new game won't leave the previous game +lying around in the background. To the \c createComponent function we have added setting the type of the block to a number between +one and three - it's fundamental to the game logic that the blocks be different types if you want a fun game. The main change was adding the following game logic functions: \list @@ -73,13 +73,14 @@ Its code is shown below: \snippet declarative/tutorials/samegame/samegame3/samegame.qml 1 This item is the exact size of the board, contains a score property, and a mouse region for input. -The blocks are now created as its children, and its size is used as the noe determining board size. +The blocks are now created as its children, and its size is used to determining the board size. Since it needs to bind its size to a multiple of \c tileSize, \c tileSize needs to be moved into a QML property and out of the script file. It can still be accessed from the script. -The mouse region simply calls \c handleClick(), which deals with the input events. Should those events cause the player to score, -\c{gameCanvas.score} is updated. The score display text item has also been changed to bind its text property to \c{gamecanvas.score}. -Note that if score was a global variable in the \c{samegame.js} file yo ucould not bind to it. You can only bind to QML properties. +The mouse region simply calls \c{handleClick()}, which deals with the input events. +Should those events cause the player to score, \c{gameCanvas.score} is updated. +The score display text item has also been changed to bind its text property to \c{gamecanvas.score}. +Note that if score was a global variable in the \c{samegame.js} file you could not bind to it. You can only bind to QML properties. \c victoryCheck() mostly just updates score. But it also pops up a dialog saying \e {Game Over} when the game is over. In this example we wanted a pure-QML, animated dialog, and since QML doesn't contain one, we wrote our own. |