www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/29/22:07:58

From: "Tudor" <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Any Allegro users want to help?
Date: 30 Dec 1996 01:32:53 GMT
Organization: Communications Accessibles Montreal, Quebec Canada
Lines: 56
Message-ID: <01bbf609$f6a0ea20$1f2a54c7@tudor.hip.cam.org>
References: <01bbf45d$777df560$932449c2 AT default>
NNTP-Posting-Host: dynappp-31.hip.cam.org
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Thomas Harte <T DOT Harte AT btinternet DOT com> wrote in article
<01bbf45d$777df560$932449c2 AT default>...
> 	All right, I have a working copy of Allegro now, but after all the
> troubles attempting to make it run, I am now having problems following
the
> readme files. And the example programs don't seem to help much either.
> Anyway, is there anyone who is feeling charitable enough to help me with
a
> few Allegro basics? All I want to do is initiate a graphics mode (basic
VGA
> will do, but I'd prefer to have the option), write filled triangles to a
> virtual RAM buffer, and copy this buffer to the video ram. Just a few
> pointers towards the commands I want to be using would be helpful, as I
> would then at least know where in the readme files I was meant to be
> reading. So, anybody want to help?
> 
> 		-Thomas
int set_gfx_mode(int card, int w, int h, int v_w, int v_h);

This is the prototype for the function.In allegro you work with somethng
called bitmaps;there is a bitmap called screen -it is the video memory.
If you want to set 320x200,you would say something like
set_gfx_mode(GFX_VGA,320,200,0,0);
you can create a bitmap with 
   BITMAP *bmp = create_bitmap(320, 200);    // make a bitmap in system RAM
					        //bitmap is 320X200 and reffered as 					       //bmp	
to get your bitmap on the screen:
void blit(BITMAP *source, BITMAP *dest, int source_x, int source_y,
          int dest_x, int dest_y, int width, int height);



In this case:
void blit(bmp,screen,0,0,0,0,320,200);

to draw a triangle:
void triangle(BITMAP *bmp, int x1, y1, x2, y2, x3, y3, int color);

SO:
........
set_gfx_mode(GFX_VGA,320,200,0,0);//get to 320X200
BITMAP *bmp = create_bitmap(320, 200);//make a bmp    
triangle(bmp,0,0,20,20,100,0,100); //stupid triangle
blit(bmp,screen,0,0,0,0,320,200);//put the bmp on the screen
......
You should read allegro.txt;all the functions are explained there.If you
print it,it's very usefull.
tudor AT cam DOT org






- Raw text -


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