Advertisement

who makes a template code?

Started by August 21, 2002 08:54 AM
3 comments, last by Da cobra 22 years, 2 months ago
with this I mean a template from which you can start of a game? or do you just start all over everytime : window initialization, DX initialization, .... and if you create a template how does it look like? I mean what do you use a globals.h? and do you already have like a mainloop.cpp & mainloop.h? I''m asking this question just to get me started, should I put a lot of time in creating such a template or not?
I am no expert (no games since DOS), so people will come along to correct me if I am wrong, but I believe a standard template to initialize the game and such is a good thing.
When I was programming my last project (never finished) in QBasic, I started by writing the main loop. I figured that if I made another game after this project, I could just gut the game and leave the startup part, which basically shows a logo, initializes the graphics, and then calls something like MainGameLoop or something.
In that loop, I then start putting specific information.
What is nice is that the menu code among other things are already written so the only thing I have to do is possibly tweak it if I find out that it is buggy or slow.
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel
Advertisement

The DirectX SDK comes with an application framework template - and you can get various for OpenGL on the net too (for use with Visual Studio I mean).
If you read up on C++ inheritance, it''s extremely easy to build an Application base class that you can derive your Game class from. That way you only have to write the reusable code once.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
I use a template.

It initializes direct draw and does all of the windows stuff that has to be done.

Once you have the basics down, there''s no reason to redo them every time you make a game, its a waste of time.

Unless you''re just learning, then it might be a better idea to rewrite it all over to help you to remember what it does and improve your understanding of it all.

This topic is closed to new replies.

Advertisement