delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/01/16:13:50

From: krugman AT nospam DOT demon DOT co DOT uk (Kevin)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Graphics with allegro
Date: Mon, 01 Mar 1999 19:44:07 GMT
Message-ID: <36daed12.442025@158.152.254.68>
References: <36DA9998 DOT 6FA1AE42 AT bellsouth DOT net>
NNTP-Posting-Host: reality-bytes.demon.co.uk
X-NNTP-Posting-Host: reality-bytes.demon.co.uk:212.228.30.60
X-Trace: news.demon.co.uk 920317433 nnrp-04:11128 NO-IDENT reality-bytes.demon.co.uk:212.228.30.60
X-Complaints-To: abuse AT demon DOT net
X-Newsreader: Forte Agent 1.5/32.451
MIME-Version: 1.0
Lines: 45
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019