tags:

views:

871

answers:

3

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

+1  A: 

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

Geoffrey Chetwood
it's basically a game on GDI+ with lots of forms and a form with some game logic on it,and it is on .NET CF
Azlam
Again, you should be looking at the technologies I mentioned, winforms is not likely to support what you want very well.
Geoffrey Chetwood
+1  A: 

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.

Michael Meadows
+1  A: 

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+)

Karg
I am not finding anything you say in the OP.His title clearly says CF. And he is asking about rendering in a 'game loop'.
Geoffrey Chetwood