46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
# PolyGun coding style
|
|
|
|
## Indentation
|
|
Use tabs for indentation (not spaces)
|
|
|
|
## Blocks
|
|
{ should be always inlined (also one space before it):
|
|
```cpp
|
|
if(condition) {
|
|
...
|
|
}
|
|
```
|
|
or
|
|
```cpp
|
|
void something() {
|
|
...
|
|
}
|
|
```
|
|
## Naming
|
|
Use `lower_snake_case` for functions, methods, variable names and namespaces.
|
|
Use `UPPER_SNAKE_CASE` for constants.
|
|
Use `UpperCamelCase` for class names.
|
|
|
|
## Include guards
|
|
Use following pattern for include guards: `POLYGUN_<engine sector>_<filename>_HPP`. Notice that `<` and `>` are only used to denote what should be placed where
|
|
and shouldn't be a part of final `#ifndef`.
|
|
Example:
|
|
```cpp
|
|
#ifndef POLYGUN_RENDERER_TEXTURE_HPP
|
|
#define POLYGUN_RENDERER_TEXTURE_HPP
|
|
|
|
...
|
|
|
|
#endif // POLYGUN_RENDERER_TEXTURE_HPP
|
|
```
|
|
|
|
## Namespaces
|
|
Each function, class etc should be placed in appropriate namespace depending on which sector it belongs.
|
|
For example: `polygun::renderer::Texture`
|
|
|
|
## Variable prefixing
|
|
Every non-static class member variable should be prefixed with `m_`, e.g. `m_renderer`. Static members should be prefixed with `s_`.
|
|
|
|
## Filenames
|
|
Use `lower_snake_case` for filenames.
|