void OnTimer();
The OnTimer() function is called 30 times per second to allow changes to be made to create animation. A DragonFireSDK program must have one function named OnTimer(). Additionally, DragonFireSDK programs must have AppMain() and AppExit() functions.
Availability
Required function starting with DragonFireSDK 1.0.
Example
Description: This program will move the image 2 pixels once each frame (30 times per sec).
#include "DragonFireSDK.h"
int Ballx; int Bally; int BallImage; int BallView;
void AppMain() { Ballx = 0; Bally = 0;
BallImage = ImageAdd("Ball.png"); // load an image BallView = ViewAdd(BallImage, Ballx, Bally); // show the image on the screen }
void AppExit() {
}
void OnTimer() { Ballx += 2; ViewSetxy(BallView, Ballx, Bally); // modify the x,y position of the view } |