Mail Archives: djgpp/1999/01/01/09:21:39
SORRY SORRY SORRY... oops... made a mistake in the for loops... the
correction is below...
Alex Lowe wrote:
>
> To plot the bitmap you need to load it... Example:
> BITMAP *mytest=load_bitmap("mytest.bmp",0);
>
> then blit it to the screen with the blit() function... look it up in the
> allegro docs for syntax... Example:
>
> blit(mytest,screen,0,0,0,0,BitmapWidth,BitmapHeight);
>
> For tiling just use some 'for' loops... Example:
>
> for(x=0;x<ScreenWidth/BitmapWidth;x+=BitmapWidth)
> for(y=0;y<ScreenHeight/BitmapHeight;y+=BitmapHeight)
> blit(mytest,screen,0,0,x,y,BitmapWidth,BitmapHeight);
THE ERROR IS WITH THESE ABOVE FOR LOOPS... the correction is here:
for(x=0;x<ScreenWidth;x+=BitmapWidth)
for(y=0;y<ScreenHeight;y+=BitmapHeight)
blit(mytest,screen,0,0,x,y,BitmapWidth,BitmapHeight);
Sorry about that.
> If your bitmap does not fit perfectly then you will end up with a gap on
> the right side of your screen... so you may need to have to loops blit
> one more extra to fill it in... by showing part of the bitmap...
>
> That should take care of it... hope it helps..
>
> -- Alex
> ayin AT immediate DOT net
>
> James5 wrote:
> >
> > Hi all. Im new to C as well as DJGPP and need a bit of help with using
> > bitmap files. I'm writing small example progams to help me out as I go
> > along and was wondering, if I have a file called mytest.bmp.. how can I
> > plot the bmp on the screen (anywhere will do), and make another program
> > to tile it on the screen (both using Allegro). Any help will be greatly
> > appreciated. :)
- Raw text -