venvirupa
asked on
stop flicker on game in Delphi 32
How do i stop the flicker in the 2D game engine on the following web site the frames should render smoothly so that there is no flicker in the frame changes. There is a transparent panel (uses the Tapanel component) for a base of the object and a animate image component to animate the images
The animate image component works on its own to do image processing but when
combined with a scrolling background there is flicker in the image when it is non scrolling (some flicker is to be expected in the scrolling image) to run the demo just move the mouse to the right edge of the screen and movement will start. (there is a exe in the download so you can also see the problem if you don't have delphi 32 ... i think the solution lies in invalidating the draw at the right point perhaps as it may be drawing the background too often........ its for a open source game any hint? thanks
http://ven.virupa.googlepages.com/gameengine
The animate image component works on its own to do image processing but when
combined with a scrolling background there is flicker in the image when it is non scrolling (some flicker is to be expected in the scrolling image) to run the demo just move the mouse to the right edge of the screen and movement will start. (there is a exe in the download so you can also see the problem if you don't have delphi 32 ... i think the solution lies in invalidating the draw at the right point perhaps as it may be drawing the background too often........ its for a open source game any hint? thanks
http://ven.virupa.googlepages.com/gameengine
P.S. You will need to manually tie the timer event and the paintbox OnPaint events up.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I knew there was another way, via handling the windows messages themselves. Good article at http://delphi.about.com/library/bluc/text/uc052102g.htm on flicker-free covers this.
ASKER
points to Barthax thanks i had seen that page on flicker hacks but lost it in my messy filesystem the panel1.doublebuffered did the trick although now the images appear progressing sideways each frame but thanks anyway I have a new line of enquiry to follow and thanks to developmentGuru for the paintbox code that gives me a line too although further from my current code base maybe you can split the points (if that can be done)? up to you Barthax
Place a timer and a PaintBox on a form and make the paint box align client. Use the following code to see smooth side scrolling with no flicker. The side scrolling is slow but that is based on the combination of the timer interval and the number of pixels you move per timer event. This example does a weak job of setting up a background similar to a very old arcade game. The setup is not perfect, just for an easy to set up example.
Let me know if you need more.
Open in new window