Mail Archives: djgpp/1999/03/02/00:05:54.1
Kevin wrote:
> 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,
[.... some stuff omitted ...]
> // blit the sprite on to the back buffer.
> blit(ball, buffer, 0,0, i,i--, 51,51);
I don't think this produces the exact result you want. I don't use
Allegro but, I can tell you that [in DJGPP] using "i" and "i--" like you do
will result in different values. That explanation may not be very clear, but
you have to remember that the parameters are actually calculated backwards
(because this is the way they are put on the stack, even this shouldn't be
relied on if you want to make portable code).
This program may illustrate the issue more clearly:
-----------------------------
#include <stdio.h>
void a(int b, int c);
int main(int argc, char *argv[])
{int aa=0;
a(aa,aa--);
printf("in main: aa=%d",aa);
return 0;
}
void a(int b, int c)
{printf("in a: b=%d c=%d\n", b, c);
}
----------------------------
Produces this output:
in a: b=-1 c=0
in main: aa=-1
----------------------------
If you changed this line to:
blit(ball, buffer, 0,0, i--,i, 51,51);
it would give you what you expected [when used in DJGPP]. But, again, this is
compiler specific.
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlisnis AT BrunNet DOT Net
Endlisnis AT HotMail DOT com
- Raw text -