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 | |
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')
-rw-r--r-- | doc/src/declarative/advtutorial1.qdoc | 2 | ||||
-rw-r--r-- | doc/src/declarative/advtutorial2.qdoc | 2 | ||||
-rw-r--r-- | doc/src/declarative/advtutorial3.qdoc | 17 | ||||
-rw-r--r-- | doc/src/declarative/advtutorial4.qdoc | 14 | ||||
-rw-r--r-- | doc/src/declarative/tutorial1.qdoc | 2 | ||||
-rw-r--r-- | doc/src/declarative/tutorial2.qdoc | 2 | ||||
-rw-r--r-- | doc/src/declarative/tutorial3.qdoc | 2 |
7 files changed, 23 insertions, 18 deletions
diff --git a/doc/src/declarative/advtutorial1.qdoc b/doc/src/declarative/advtutorial1.qdoc index 44a9c42..1d47615 100644 --- a/doc/src/declarative/advtutorial1.qdoc +++ b/doc/src/declarative/advtutorial1.qdoc @@ -42,8 +42,8 @@ /*! \page advtutorial1.html \example declarative/tutorials/samegame/samegame1 -\title Advanced Tutorial 1 - Creating the game canvas and block \target advtutorial1 +\title Advanced Tutorial 1 - Creating the Game canvas and block The first step is to create the items in your application. In Same Game we have a main game screen and the blocks that populate it. diff --git a/doc/src/declarative/advtutorial2.qdoc b/doc/src/declarative/advtutorial2.qdoc index 97cd744..0265446 100644 --- a/doc/src/declarative/advtutorial2.qdoc +++ b/doc/src/declarative/advtutorial2.qdoc @@ -41,8 +41,8 @@ /*! \page advtutorial2.html -\title Advanced Tutorial 2 - Populating the Game Canvas \target advtutorial2 +\title Advanced Tutorial 2 - Populating the Game Canvas Now that we've written some basic elements, let's start writing the game. The first thing to do is to generate all of the blocks. Now we need to dynamically 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. diff --git a/doc/src/declarative/advtutorial4.qdoc b/doc/src/declarative/advtutorial4.qdoc index 514c11a..b06634f 100644 --- a/doc/src/declarative/advtutorial4.qdoc +++ b/doc/src/declarative/advtutorial4.qdoc @@ -41,8 +41,8 @@ /*! \page advtutorial4.html -\title Advanced Tutorial 4 - Finishing Touches \target advtutorial4 +\title Advanced Tutorial 4 - Finishing Touches Now we're going to do two things to liven the game up. Animate the blocks and add a web-based high score system. @@ -52,6 +52,7 @@ which we've placed all the QML but the main file. \section2 Animated Blocks +<<<<<<< HEAD:doc/src/declarative/advtutorial4.qdoc The most vital animations are that the blocks move fluidly around the board. QML has many tools for fluid behavior, and in this case we're going to use the \l Follow element. By having the script set \c targetX and \c targetY, instead of \c x and \c y directly, we can set the \c x and \c y of the block to a follow. \l SpringFollow is a property value source, which means @@ -59,6 +60,9 @@ that you can set a property to be one of these elements and it will automaticall The SpringFollow's value follows another value over time, when the value it is tracking changes the SpringFollow's value will also change, but it will move smoothly there over time with a spring-like movement (based on the spring parameters specified). This is shown in the below snippet of code from \c Block.qml: +======= +The most vital animations are that the blocks move fluidly around the board. QML has many tools for fluid behavior, and in this case we're going to use the SpringFollow element. By having the script set targetX and targetY, instead of x and y directly, we can set the x and y of the block to a follow. SpringFollow is a property value source, which means that you can set a property to be one of these elements and it will automatically bind the property to the element's value. The SpringFollow's value follows another value over time, when the value it is tracking changes the SpringFollow's value will also change, but it will move smoothly there over time with a spring-like movement (based on the spring parameters specified). This is shown in the below snippet of code from Block.qml: +>>>>>>> f36619d24bc1a2b1e9bef6b4fac7d5d9a1916b7c:doc/src/declarative/advtutorial4.qdoc \code property int targetX: 0 @@ -70,10 +74,10 @@ parameters specified). This is shown in the below snippet of code from \c Block. We also have to change the \c{samegame.js} code, so that wherever it was setting the \c x or \c y it now sets \c targetX and \c targetY (including when creating the block). This simple change is all you need to get spring moving blocks that no longer teleport -around the board. If you try doing just this though, you'll notice that they now never jump from one point to another, even -in the initialization! This gives an odd effect of having them all jump out of the corner (0,0) on start up. We'd rather -that they fall down from the top in rows. To do this, we disable the x Follow (but not the y follow) and only enable it after -we've set the \c x in the \c createBlock function. The above snippet now becomes: +around the board. If you try doing just this though, you'll notice that they now never jump from one point to another, even in +the initialization! This gives an odd effect of having them all jump out of the corner (0,0) on start up. We'd rather that they +fall down from the top in rows. To do this, we disable the \c x follow (but not the \c y follow) and only enable it after we've set +the \c x in the \c createBlock function. The above snippet now becomes: \snippet declarative/tutorials/samegame/samegame4/content/BoomBlock.qml 1 diff --git a/doc/src/declarative/tutorial1.qdoc b/doc/src/declarative/tutorial1.qdoc index c9a1c5a..ad454f2 100644 --- a/doc/src/declarative/tutorial1.qdoc +++ b/doc/src/declarative/tutorial1.qdoc @@ -1,7 +1,7 @@ /*! \page tutorial1.html -\title Tutorial 1 - Basic Types \target tutorial1 +\title Tutorial 1 - Basic Types This first program is a very simple "Hello world" example that introduces some basic QML concepts. The picture below is a screenshot of this program. diff --git a/doc/src/declarative/tutorial2.qdoc b/doc/src/declarative/tutorial2.qdoc index 66a0515..796d0f9 100644 --- a/doc/src/declarative/tutorial2.qdoc +++ b/doc/src/declarative/tutorial2.qdoc @@ -1,7 +1,7 @@ /*! \page tutorial2.html -\title Tutorial 2 - QML Component \target tutorial2 +\title Tutorial 2 - QML Component This chapter adds a color picker to change the color of the text. diff --git a/doc/src/declarative/tutorial3.qdoc b/doc/src/declarative/tutorial3.qdoc index d766015..8ef32d4 100644 --- a/doc/src/declarative/tutorial3.qdoc +++ b/doc/src/declarative/tutorial3.qdoc @@ -1,7 +1,7 @@ /*! \page tutorial3.html -\title Tutorial 3 - States and Transitions \target tutorial3 +\title Tutorial 3 - States and Transitions In this chapter, we make this example a little bit more dynamic by introducing states and transitions. |