Create CODING_STYLE.txt
This commit is contained in:
parent
2eaf6dfae4
commit
1559891de8
45
CODING_STYLE.txt
Normal file
45
CODING_STYLE.txt
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# 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.
|
Loading…
x
Reference in New Issue
Block a user