Re: why does this code only work some times

new topic     » goto parent     » topic index » view thread      » older message » newer message
jpbg33 said...

All I'm trying to do in this program is to load 2 bitmaps and then copy both of them to another bitmap and display the new bitmap. To get rid of fliker in a game im making.

The Bitmap control type is best suited for static images; ones that are not animated.

For animated images, it better to use a combination of a Window control and a Pixmap control. The Window is used to actually display the current image and the Pixmap is used to build or create the image details. Then whenever either the image is changed or the Window needs repainting, the Window's paint event would simply bitblt the Pixmap contents to the Window.

When you are finished updating the image in the Pixmap, you signal to the Window that it needs to be refreshed. The flicker effect is caused when the default Windows repaint function is used. This happens because the Window is first wiped clean by setting all pixels to the background colour, then the foreground pixels are set. To avoid this, use the repaintFG() call rather than the repaintWindow() call.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu