Question

Hi i want to write a game with a main game form and lot of other normal forms. What is the best way to manage update-paint cycle in that case?

Should the game form paint loop only should be overriden? or should i do an application.do events() in the main method?

Please guide me regarding this. i am new to windows forms world

Was it helpful?

Solution

Your logic thread should be separate from the form, so you won't need DoEvents(). If you're using GDI+, then you should force an Update() on a loop. Windows Forms doesn't do double buffering very well, so depending on how sophisticated your graphics will be you might have some difficulties with flicker.

My suggestion is to look at using the DirectX managed library. It's a lot to learn, but gives you everything you need.

EDIT: I have been reading recently about WPF, which seems like a much better platform for simple to moderately complex games, because it provides a much higher level API than the DirectX managed Library. It probably has performance and flexibility limitations for more complex games, however.

OTHER TIPS

The body of the question doesn't mention Compact Framework, just Winforms. This is pretty much the accepted answer for Winforms from Tom Miller (Xna Game Studio and Managed DirectX guy from Microsoft):

Winforms Game Loop

@Rich B: The game loop is independent of how the rendering is done (DirectX, MDX, GDI+)

If you are making a game, you should be looking into DirectX, OpenGL, or XNA.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top