Page 1 of 1

Flickering Using CGapiApplication

PostPosted: Sep 22, 2002 @ 2:49am
by CapesDev

I got it

PostPosted: Sep 22, 2002 @ 3:00am
by CapesDev

PostPosted: Sep 23, 2002 @ 3:36am
by ppcStudios

PostPosted: Sep 25, 2002 @ 8:58pm
by CapesDev
I used a similar technique for most of my game structure. That is, used base classes that had virtual draw(), update(), etc and were implemented in the derived classes. It sill made it tricky to deal with because I had many cases where I wanted a very scripted set of processing that did not easily fit within the overall 'update, plot' paradigm. Anyhow, good to know someone else gave thought to this :)

PostPosted: Sep 25, 2002 @ 9:21pm
by Thitsa
I am doing the exact same thing that you are trying to do in my grid based game. My solution was to have the ProcessNextFrame method call the Animate() routine which updates the data members depending of the state of the object. For example, suppose my Man is to move from one grid to another and the move requires 5 steps. I would call a Move() on my Man object that sets up the appropriates flags and counters so that the next time Animate() is called on it, it will animate/move the image one position and update the counter. Animate() will end the move cycle when the end of the counter (5 iterations) is reached. So when the ProcessNextFrame is called, it will call Animate() on the Man, which in turn will update the position and image of the man as necessary. Now ProcessNextFrame can call the Draw() on the Man to display the correct image at the correct position. The effect is that while the Man is in the Move mode, it will move from one grid cell to another in 5 steps, independent of user interaction. Note that a redraw is done only once per call to ProcessNextFrame, eliminating the flickering. You can also have Animate called by timer if you want the fully seperate the display and logic methods. I'm sure there are many ways of doing this but this is what works for me. Hope that helps.

PostPosted: Sep 27, 2002 @ 12:58am
by iceboxman