Click to See Complete Forum and Search --> : Animation on screen DC
Advent
Mar 22nd, 2002, 04:03 AM
I've been trying to animate a bitmap onto the screen DC, but haven't been able to manage it properly. I can animate bitmaps fine on forms etc with bitblt, but the screen DC is different as there is no .cls and .refresh.
The main problem is that I have not been able to get rid of the flickering caused by using redrawwindow (so that the bitmap doesn't leave a copy of itself behind as it moves around). Does anyone know of a way to stop the screen from refreshing until it has been cleared and the bitmap redrawn?
Cheers... :)
/\/\isanThr0p
Mar 22nd, 2002, 10:08 AM
well this is how I did it:
first I copied the part of the screen that I wanted to do the animation on than I blitted my pic on that copy and blitted it back instead of cleaning up the screen by the redrawWindow thing...
I hope you got me...
Advent
Mar 22nd, 2002, 11:28 AM
Yup, I think I got you.. trouble is that when I blit straight from the screen DC to the backbuffer it still has the last frame's picture on it.. i.e. I need to clean off everything i'd already blitted before the next frame, otherwise the next frame will include everything for the last frame. Or am I missing something?
/\/\isanThr0p
Mar 22nd, 2002, 12:03 PM
that is true that is why you have to make a copy first don't blit the copy of the screen directly on the backbuffer but into a dc first than from that dc to the backbuffer and than you animpic... pretty straight....
/\/\isanThr0p
Mar 22nd, 2002, 12:04 PM
well I just saw you are on right this moment
so if you want to add me to icq the number in my signature is my UIN
Advent
Mar 22nd, 2002, 12:49 PM
Yeh, thats one option.. but what if the user moves/minimises/maximises/loads/unloads a window? This isn't reflected in the backbuffer, which still shows the screen in the state it was when the animation first started.
I suppose you could redraw the screen and refresh the backbuffer every second or so.. hopefully then both the flicker and the ghost effect caused by a moving window wouldn't be too noticeable. I was hoping that there would be a better solution, though.
Thanks for the help, btw :)
/\/\isanThr0p
Mar 22nd, 2002, 01:56 PM
you could check for new windows beeing created...
well I can see your problem, I will think about it.
my animation was a little ostrich running over the screen so it never remained at one place for a longer time anyways so I had to do a lot more of getting a writing to the desktop dc anyways.. (I only wrote lines, so I would not have to blt to much to the desktop since this is the critical moment that creates flikering)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.