Mail Archives: djgpp/1999/03/01/16:13:50
Hi, Ringo,
I'm only a beginer withe Allegro, but this is fairly simple, It sets
the graphics to 640 * 400 * 8bpp and then draws a bitmap of a circle,
then the bitmap of the circle moves from the bottom right of the
screen to the top left,
#include "allegro.h"
int main()
{
allegro_init(); // Start the Allegro Graphics Library.
set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
BITMAP *buffer = create_bitmap(640, 480);// Create buffer.
BITMAP *ball = create_bitmap(51,51); // Create a sprite bitmap.
clear(screen);
clear(buffer);
clear(ball);
circle(ball, 25,25,25,15); // Put something on the sprite bitmap.
int i = 429;
while(!kbhit())
{
// blit the sprite on to the back buffer.
blit(ball, buffer, 0,0, i,i--, 51,51);
if(i < 1) // If the sprite is at top of screen -
i = 429; // move it back to the bottom.
vsync(); // Wait for vertical retrace.
// Blit the back buffer on to the screen.
blit(buffer, screen, 0,0, 0,0, 640,480);
clear(buffer);
}
allegro_exit(); // Shutdown the Allegro Graphics Library.
return 0; // And terminate.
}
Kevin.
If you wish to Email or ICQ me, use
kevin AT reality-bytes DOT demon DOT co DOT uk
or
25646989
- Raw text -