![](smile.gif)
Object oriented Windows
Hi,
I was wondering what Windows C++ game designers normally do about the Windows programming aspect of their game. Do you encapsulate your Window in a class? Or do you only have classes for the actual game elements? If you encapsulate Windows, is there a common way to do it? I''m just curious how all you OOP Windows C++ people handle that stuff. Any comments would be appreciated
Prime
![](smile.gif)
PRIMEWarped Productions
Because my game doesn''t interact that much with windows anyway (only creates a window, then that''s about it) I just call the various functions wherever I need them.
I create the window in my main game object (as opposed to say the renderer class) since it''s used in the renderer class, the input class, and also the logging class (for displaying message boxes when there''s a fatal error)
War Worlds - A 3D Real-Time Strategy game in development.
I create the window in my main game object (as opposed to say the renderer class) since it''s used in the renderer class, the input class, and also the logging class (for displaying message boxes when there''s a fatal error)
War Worlds - A 3D Real-Time Strategy game in development.
i do encapsulate..
just common stuff, Window, Thread, File
quite handy to have a Thread and File class to handle all the nitty gritty stuff associated with synchronisation and reading / writing..
{ Stating the obvious never helped any situation !! }
just common stuff, Window, Thread, File
quite handy to have a Thread and File class to handle all the nitty gritty stuff associated with synchronisation and reading / writing..
{ Stating the obvious never helped any situation !! }
I put the window creation/handling and message handling all in a class this way I can cover it with a try&catch in WinMain and make it really easy and safe for error and use.
example of my usual WinMain:
example of my usual WinMain:
int _stdcall WinMain(HINSTANCE Instance, HINSTANCE Prev, LPSTR Commands, int Show){ D3DTest *Test = NULL; try { Test = new D3DTest(); Test->Create(Instance, Show); int run = Test->Run(); delete Test; return run; } catch (LPCTSTR error) { MessageBox(NULL, error, TEXT("Direct3D Test"), MB_OK | MB_ICONERROR); delete Test; return 1; }}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement