So you can draw a image to the screen, flip the backbuffer, and delay for a while...
... but thats just images, surfaces can do alot more:-
function Delay(ms)
{
var until = GetTime() + ms;
while(until < GetTime());
}
function ShowPicture(filename,x,y, delay)
{
var picture = LoadImage(filename);
picture.blit(x,y);
FlipScreen();
Delay(delay);
}
Now you can show pictures using ShowPicture...
But really, you need to just understand what ShowPicture does...
LoadImage(filename) === Loads the image 'filename' from the games' images directory.
var picture = LoadImage(filename) === Loads the image, and allocates 'picture' as the image object.
picture.blit(x,y) === Draws (blit is an old word meaning draw, heh) the 'picture' image at (x,y)
FlipScreen() === Shows the drawing...
Delay(delay) === Delays for 'delay' amount of time, so that you can view the image..
So now've we've got a simplifing function... lets draw a neat image on the screen for 5 seconds...
function game()
{
ShowPicture("neat.jpg",0,0, 5000);
}
Thats its folks, soon, I will cover *whatever* anyone wants me to..
|