Not all code follows this currently. Try to make any new code you write follow this document. Old stuff can be slowly migrated over. Don’t worry too much if your code doesn’t match this, but it would be nice if at some point in the not too distant future all the code followed these guidelines.
I think a good example of these can be found in entity_manager.cpp and entity_manager.h
Class names
Classes should begin with the letter C and then use upper case for the beginning of every world in the name. No underscores should be used.
Example: CWorld, CDisplayManager
Class member function names
All words in the name should begin with capitals like class names.
Example: CWorld::Draw(), CDisplayManager::DrawTriangleFans()
Class member variables
This is perhaps the most inconsistently named thing in BuNg at this time. The original coding style used m_ at the beginning of member variables and I believe this is the way to go. I wouldn’t worry too much about spending lots of time updating current code to this style; it should be slowly moved across.
Member variables (in fact, variables in general) should use lower case and underscores where appropriate.
Examples: CWold::m_particle_system, CDisplayManager::m_display
General/temporary variables
See above.
Global variables
I try to cut these down as much as possible. If you must use a global that needs to be accessible from multiple parts of BuNg it can be contained in CWorld.
Enums
I’m not sure how we should name enums. Thoughts?
{ style
This can best be illustrated with examples:
// Class
class CWorld
{
CWorld();
};
// Function
CWorld::CWorld()
{
int i;
// Code block inside function
for(i = 0; i < 10; i++) {
Log("%dn", i);
}
}
Indentation and tabs
Tabs should be written to file as spaces. The indentation width used should be 4 spaces.