Piotr Łużecki
Piotr Łużecki

Reputation: 1041

C# Simple Game architecture

Im going to make simple game with fallowing architecture:

Initialization
OpenWindowAndGraphics
while(game_not_end) {
    ReadEvents
    UpdateData
    RePaint
}
CloseWindow

I'm making this in Windows Forms. Firstly i tought that i will make my own Panel. In constructor i will initialize everything, but now i'm not sure where should i make game loop. Game will be simple, but i will extend it as soon as i will make things works. Main class looks like this:

        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1(sessid,serwer));

In the Form1 is only SpecialPanel which have overriden Constructor and OnPain method (to initialize and Draw everything). So i need to control when Panel is repainting and make game loop. How can i do this?

Upvotes: 2

Views: 1735

Answers (3)

Olivier Jacot-Descombes
Olivier Jacot-Descombes

Reputation: 112447

I would use XNA to develop a game. The tutorials found on Riemers's XNA Tutorials helped me a lot in creating a game.

Upvotes: 1

this. __curious_geek
this. __curious_geek

Reputation: 43207

Windows Forms uses GDI+ for rendering. I don't think Windows Forms is a good choice for developing a game unless it is just a matter of interest. Otherwise XNA Game SDK lets you develop games using C# very easily and it provides everything you need to develop a good game. The lifecycle of a Game program you're trying to define is already there in XNA SDK..

Upvotes: 4

George Karanikas
George Karanikas

Reputation: 1244

Take a look at the guide here. It will get you started and answer your question.

Upvotes: 3

Related Questions