Files
PolyGun/docs/CODING_STYLE.MD
2023-05-02 12:32:13 +02:00

1.1 KiB

PolyGun coding style

Indentation

Use tabs for indentation (not spaces)

Blocks

{ should be always inlined (also one space before it):

if(condition) {
	...
}

or

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:

#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.