# Hibis Coding Standards ## CXX Language Use C++17 as the C++ standard. Hibis should compile under all major compilers. ## Structure Each module of the game engine should be kept within their specific folders. E.g.: - Core - Renderer/(renderer name) If statically linking third party libraries are *absolutely* required, they must be placed in a folder called `external` in the repository root. ## Formatting Files need to end with a new line.
Indenting should be done using hard tabs (the tab character) rather than spaces.
New lines should be after `{` with the exception of class/struct construction which has no newlines at all.
There should be one class per file. ## Includes `#include` uses must go in the following order (with each section seperated by an extra newline): ```cpp #include // From Hibis #include // Use header in current dir #include "relative-header" ``` Include guards should be handled via `#pragma once`. ## Variables Variables should be camelCase and be named to make it obvious what their purpose is.
Variables should be prefixed with specific chars depending on where the variable is. - Member Variable - Prefix with `m` - Global Variable - Prefix with `g` - Static Variable - Prefix with `s` Example: ```cpp const int gAmountOfTimesISuccessfullyWriteGoodVariableNames = 0; class ExampleClass final { public: ExampleClass() {} ~ExampleClass() {} // dont ask void hmmmTimeToScream() { std::cout << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa" << std::endl; } private: std::string mMyName = "Example Class"; } ``` ## Classes If a class is not going to be used/intended to be used for polymorphism, mark it as a `final` class.
Base classes should make all functions `virtual` to allow for functions to be overriden.
Simple set/get functions should be inside of the header file on a single line.
Class names should be in PascalCase and be obvious what their purpose is.