Archived

This topic is now archived and is closed to further replies.

Some adive on creating a window class

This topic is 6080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was thinking of how to go about writing a function to handdle creating my window class. Since every game has pretty much the same window class settings I would only need to pass a couple argumeants to it for my purposes, and leave the unneeded parameters hardcoded inside the function. My goal Is to reuse these functions in all my game experimeants, but are there any potential pitfalls? Now my question is would it be a good idea to handle registering the class, and window creation in this function, or is it best to do this manually? Well, here is a basic Idea of what I''m proposing... WinMain(blah, blah) { CreateWinClass(blah, blah, blah) // create and register winclass CreateWindow(blah, blah, blah) // create and show window // rest of the game code. (input, render, etc.. etc..) .... } OR WinMain(blah, blah) { // Create windows class, register, create window, and // show window. CreateShowWindow(blah, blah, blah, blah) // rest of the game code. (input, render, etc.. etc..) } Is this a good idea? Thank you for any advice, but please don''t point me to any code that already does this because I would like to do this myself.

Share this post


Link to post
Share on other sites
Theres a pretty good tutorial about the subject at www.relisoft.com - they have some nice ideas, like operator overloading and such...
also they solve the problem of the WindowProcedure...

It is worth reading

And the advice you asked for...
Consider a base class. Think about the stuff required for the CTOR ...

Share this post


Link to post
Share on other sites