hi,
i attached a zip file with the exe and source of my program. if you start the exe, you'll see, that there are balls that are bouncing out from each other. the balls are bitmaps that are bitblt on the screen. of course bitmaps have to be rectangular. and this is my problem: when the balls touch each other on the corners, the black corners of for example two balls are bitblt one over the other what causes something like flickering. you can see that in the program. my question now is: is it possible to remove that WITHOUT using for example static controls with window regions?

hope you can help me. i'm lookin' forward for answers.

NOP-erator
Posted on 2001-10-01 05:17:37 by NOP-erator
Hi !

If you don't have overlaps with your sprites then do this:

Before drawing clear the entire playfield (or mostly the part which is drawn last frame) Then put your sprites setting the rop-code to a OR-mode ( I do not remember the constant-name now ...)

The other way is to get a one-plane mask-bmp of your sprite-object and use maskblt instead of your blitting-methods
This has the advantage that your sprites may be drawn overlapping each other without "getting the colors wrong" ;)

Greetings CALEB
Posted on 2001-10-01 07:25:29 by Caleb
maybe you can try to select a circular clip rgn before blitting the bitmaps.
Posted on 2001-10-01 07:31:47 by beaster
on bitmaps? how to do that?

caleb: "one-plane mask-bmp " could you explain that a bit more please?

NOP-erator
Posted on 2001-10-01 07:37:36 by NOP-erator
a one-plane-bitmap is a monochrome bitmap (only black and white, meaning bit/pixel = 0 or bit/pixel = 1).
You can use this as masking as if you put pixels to one everywhere your image/sprite has a valid pixel. (Of course the source image-rectangle and the mask-rectangle must have the same width and height !!!)
On windows system normaly the mask is inverted, so valid pixels have to be masked as bits set to zero !

Greetings, CALEB
Posted on 2001-10-01 07:59:50 by Caleb
I have no example, but I think something like this can work:

; draw one object

hrgnClip = CreateEllipticRgn(objects position)
SelectClipRgn (hdcOut, hrgnClip)
BitBlt (hdcOut, hdcBitmap)
SelectClipRgn (hdcOut, 0)
DeleteObject (hrgnClip)

BitBlts are clipped at the clip regions like all other GDI commands.
Posted on 2001-10-01 10:21:35 by beaster
Hello Beaster !

Maybe it's a fine solution to use regions but they are terrible slow. If you create a elliptic region GDI produces lots of rectangles which will form the elliptic region if put together. So GDI will test each of the particular regions if drawing could take place. I'd tried them to do a bitmap-filling of complex regions ...
Greetings, CALEB
Posted on 2001-10-01 11:01:16 by Caleb