Mail Archives: djgpp/1998/04/19/12:46:34
Bengt Rosenberger schrieb in Nachricht <6h8pv3$m8$1 AT unlisys DOT unlisys DOT net>...
>I have created a bitmap called bmp which is SCREEN_W * 3 and 30 large. I
>printed text on it and tried to scroll it using stretch_blit.
>It works fine but when the bitmap has scrolled one time the bitmap bmp goes
>up one pixel and there is one row with coloured garbage under it and with
>every new scroll another line appears!
>
I dont know what code your using, but i gess its something like:
int x=0;
while(1) { // do endless scrolling
if(x+bmp->w>0) // still inside screen ?
stretch_blit(bmp,screen,
0,0,(SCREEN_W * 30) / SCREEN_H,30, // with bmp->h=30,
x,0,SCREEN_W,SCREEN_H); // and bmp->w larger
else x=0; // start all over again
if(x+bmp->w<SCREEN_W) // only right half fo bmp inside screen ?
blit(bmp,screen,0,0,x+bmp->w,0,SCREEN_W,SCREEN_H);
// need to put left part of bmp at the right
x=x-1; // scroll left (most likely when scrolling text)
}
this should work, but if it behaves like you describe, there seems to be
a bug with Allegro's clipping. Normally, any blitting functions perform
clipping at the range (0,0,bmp->w-1,bmp->h-1), so the code above
would work.
However i did not test it, its just the algorithm i'd use to scroll a
bitmap...
hope i could help
Elias Pschernig
- Raw text -