#include <AnimationEngineAPI.h>
Public Member Functions | |
virtual void | startAnimation (QGraphicsScene *targetGraphicsScene)=0 |
Start playing the animation in graphics scene provided as parameter. | |
virtual void | startAnimationPreview (QGraphicsScene *targetGraphicsScene) |
Start playing preview. | |
virtual void | refreshMouseCoordinates (int x, int y) |
Called by Xiaoning's Diary to update the location of mouse within the window. | |
virtual void | stopAndCleanUp ()=0 |
Stop the animation and do clean up. | |
virtual QString | getAnimationName ()=0 |
Get name of the animation. | |
virtual QString | getAnimationBg ()=0 |
Get full path to animations own background picture (QString::null if there isn't any). | |
virtual void | sceneSizeChanged (qint64 width, qint64 height) |
Update the size of the scene used for displaying background animation. | |
Protected Attributes | |
qint64 | iWidth |
Stores the width of graphics scene used for animation. | |
qint64 | iHeight |
Stores the height of graphics scene used for animation. | |
QMutex | iWidthAndHeightMux |
Protect iWidth and iHeight. Multi threading needed for sure in animations. | |
int | iMouseX |
Stores the x-coordinate of the mouse cursor within window. | |
int | iMouseY |
Stores the y-coordinate of the mouse cursor within window. | |
QMutex | iMouseCoordinatesMux |
Protect iMouseX and iMouseY. Multi threading needed for sure in animations. |
Xiaoning's Diary will use the methods in this base class to interact with background animations.
QString AnimationEngineAPI::getAnimationBg | ( | ) | [pure virtual] |
Get full path to animations own background picture (QString::null if there isn't any).
Implement to return the full path and file name of picture that should be used as a background for the animation. If there is no background picture, return QString::null and the animation will use the picture that is set as background by user from background picture dialog.
Implemented in floatingClouds, and ItIsSnowing.
QString AnimationEngineAPI::getAnimationName | ( | ) | [pure virtual] |
Get name of the animation.
Implement to return the name of the animation that can be used in the list of animations. This is the name the user will see when selecting background animation from the background animations dialog.
Implemented in floatingClouds, and ItIsSnowing.
void AnimationEngineAPI::refreshMouseCoordinates | ( | int | x, | |
int | y | |||
) | [inline, virtual] |
Called by Xiaoning's Diary to update the location of mouse within the window.
Can be used to implement some interaction between user and animation. By default only stores the the coordinates to internal iMouseX and iMouseY variables. Overwrite if more actions is needed when mouse is moving. See class mouseFollowerTest for example on how to use.
x | x-coordiante of the mouse cursor within the window. | |
y | y-coordinate of the mouse cursor within the window. |
void AnimationEngineAPI::sceneSizeChanged | ( | qint64 | width, | |
qint64 | height | |||
) | [inline, virtual] |
Update the size of the scene used for displaying background animation.
Called by Xiaoning's Diary to let the animation engine know that the size of the scene used for displaying animation has changed. By default will only store the new values to internal variables iWidth and iHeight. Overwrite if more actions is needed when the size is changed.
width | new width of the graphics scene used for animation. | |
height | new height of the graphics scene used for animation. |
void AnimationEngineAPI::startAnimation | ( | QGraphicsScene * | targetGraphicsScene | ) | [pure virtual] |
Start playing the animation in graphics scene provided as parameter.
targetGraphicsScene | Pointer to graphics scene for playing the animation in. |
Implemented in floatingClouds, and ItIsSnowing.
void AnimationEngineAPI::startAnimationPreview | ( | QGraphicsScene * | targetGraphicsScene | ) | [inline, virtual] |
Start playing preview.
No need to overwrite if you don't want to but in case you want you can do things like scale the graphics to fit better in small preview window (unless they don't follow the size of the window anyway) or even just show a description of the animation if you think the preview wouldn't give good enough picture of it.
Reimplemented in floatingClouds, and ItIsSnowing.
void AnimationEngineAPI::stopAndCleanUp | ( | ) | [pure virtual] |
Stop the animation and do clean up.
The function should be implemented so that it will stop all the threads created by the animation and deletes all data that is needed only when animation is running.
Implemented in floatingClouds, and ItIsSnowing.
qint64 AnimationEngineAPI::iHeight [protected] |
Stores the height of graphics scene used for animation.
iHeight : qint64
QMutex AnimationEngineAPI::iMouseCoordinatesMux [protected] |
Protect iMouseX and iMouseY. Multi threading needed for sure in animations.
iMouseCoordinatesMux
int AnimationEngineAPI::iMouseX [protected] |
Stores the x-coordinate of the mouse cursor within window.
iMouseX : int
int AnimationEngineAPI::iMouseY [protected] |
Stores the y-coordinate of the mouse cursor within window.
iMouseY : int
qint64 AnimationEngineAPI::iWidth [protected] |
Stores the width of graphics scene used for animation.
iWidth : qint64
QMutex AnimationEngineAPI::iWidthAndHeightMux [protected] |
Protect iWidth and iHeight. Multi threading needed for sure in animations.
iWidthAndHeightMux