//====================================================
// App.cpp
//====================================================
#include "DragonFireSDK.h"

int Ballx;
int Bally;
int BallImage;
int BallView;
bool left = false;

void AppMain()
{
     LandscapeMode();
	ViewAdd("Images/grass.jpg", 5, 5);

	Ballx=120;
	Bally=25;

	BallImage=ImageAdd("Images/Ball.jpg"); // load an image
	BallView=ViewAdd(BallImage,Ballx,Bally); // show the image on the screen



}

void AppExit()
{
	// Application exit code goes here.  Perform any clean up your app might 
	// need to do in the event of interruption by a phone call or the user
	// pressing the Home button, or some other event that would cause your
	// application to terminate.
}

void OnTimer()
{
	if((Ballx< 320)&&(left ==false))
	   Ballx+=2;
	else if(Ballx<25)
	{
		Ballx+=2;
		left = false;

	}
    else
	{
        left = true;     
		Ballx -=2;

	}

	ViewSetxy(BallView,Ballx,Bally); // modify the x,y position of the view
}