int WorldSetxy(int x, int y);

 

This function sets the view port of the screen. This is 0,0 by default, but you can use this function to scroll to other places in the world view. If your background image is wider than the screen, change the world view using this function and scroll to any position in the background. In addition, you can have various images placed off screen in that background and simply scroll them into view! If you use ViewAdd to place an image at 500, 0 it will be off of the screen until you set the world view port at 500, 0 to see it.

 

You do not need to use this function at all unless you want to scroll backgrounds or pages into view.

 

Return Value

 

Return not used.

 

Parameters

 

x

x coordinate.

 

y

y coordinate.

 

Remarks

 

Change the location of the world view to the specified x, y coordinates. Side-scroller games can use this function to scroll through the world.

 

Availability

 

Available in DragonFireSDK 1.0 and later.

 

Example

 

Description: This example will display Ball.png at coordinates 500, 0 off of the screen. The OnTimer() will use WorldSetxy() to scroll it into view.

 

#include "DragonFireSDK.h"

 

int Worldx;

 

void AppMain()

{

  int vw;

 

  Worldx = 0;

 

  vw = ViewAdd("Ball.png", 0, 0);

  ViewSetxy(vw, 500, 0);

}

 

void AppExit()

{

 

}

 

void OnTimer()

{

  if (Worldx < 500)

  {

     Worldx += 4;

     WorldSetxy(Worldx, 0);

  }

}