IMO without doubt the BEST one is MSVC
Than we need to arrange coding style rules to avoid mess. This one I'm going to present is one of the most clear I've seen and I'm using it for a long time:
GENERAL FILES STRUCTURE
File header - each file must begin with a logo or some information about program it belongs to
Separate code blocks (includes, definitions, implementations, externals) with sth like this:
Code: Select all
//-------------------------------------------------------
// Includes
//-------------------------------------------------------
Code: Select all
/*
** FunctionName
** ----------------
** Here we put info about what does the function do
** @ param name_of_parameter : description of parameter
** @ param ... etc
*/
VARIABLE AND TYPES NAMING
global variables should have a type shortcut at the beginning:
Code: Select all
int iVariableInteger;
BITMAP* bmpBitmapObject;
char* chString;
unsigned long int ulArray[];
tStructure sStructure;
cCLASS cClass;
For structures and classes: each typedef structure name should begin with t and rest same sa in variables. Classes should begin with small c and the rest in UPCASE(tTile, tVehicleParameters, cGAME, cOBJECT )
member variables should begin with m_ and rest same as is other variables ( letter defining type and the rest) - that will prevent doubts whether the variable is a member or global one
MAIN PROGRAM STRUCTURE
whole game architecture should consist of few general objects:
GAME class, ENGINE class, RENDER class, CONFIG class e.g.
Program begins with:
Initializing cGame object (reseting all variables)
Initializing cEngine object (install input devices and create basic game window, init Renderer)
Load necessary configuration (beginning video mode, setting up paths to all .ini files, load menu and cursor)
Set appropriate screen res or window size
Load and run main menu
Init cMap object, load/generate the map, load all terrain textures and put them into cTileset, then load game objects (structures, vehicles, additional stuff like shaders)
Game loop
Destroy Game object with deinitializing all others, clean up memory issues
That's the basic architecture I think
With defined uni-style we can safely enlarge on main objects construction= GAME and ENGINE
I'm listening to suggestions and/or total critique