aboutsummaryrefslogtreecommitdiff
path: root/contributing.md
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-10-16 13:09:28 +0200
committermax-001 <maxsmits21@kpnmail.nl>2024-10-16 13:09:28 +0200
commit85514636cbf9ae34afc8d6c863e9760f291e6478 (patch)
tree4e745d504a0c55386aa20f079dfdaa0d32ac31aa /contributing.md
parent809db83cd515c6c2b1d404811354208cf97a5c07 (diff)
parent579824011d5e8776e2079d6624a39535517760ff (diff)
Merge remote-tracking branch 'origin/master' into max/POC-ECS-memory-efficient
Diffstat (limited to 'contributing.md')
-rw-r--r--contributing.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/contributing.md b/contributing.md
index eec5bc0..364e835 100644
--- a/contributing.md
+++ b/contributing.md
@@ -17,11 +17,48 @@
# Code style
- ASCII only
+- Class names are always singular
+- Explanatory comments are placed above the line(s) they are explaining
+- Source files should only contain comments that plainly state what the code is
+ supposed to do
+- Explanatory comments in headers may be used to clarify implementation design
+ decisions
- Formatting nitty-gritty is handled by clang-format/clang-tidy (run `make
format` in the root folder of this repository to format all sources files)
- When using libraries of which the header include order is important, make
sure to separate the include statements using a blank line (clang-format may
sort include statements, but does not sort across empty lines).
+- All engine-related code is implemented under the `crepe` namespace,
+ user-facing APIs under `crepe::api` (the folder structure should also reflect
+ this).
+- `using namespace` may not be used in header files, only in source files.
+- Do not (indirectly) include private dependency headers in API header files,
+ as these are no longer accessible when the engine is installed
+- Getter and setter functions are appropriately prefixed with `get_` and
+ `set_`.
+- Doxygen commands are used with a backslash instead of an at-sign (i.e.
+ `\brief` instead of `@brief`)
+- A singleton's instance is always accessed using a getter function that
+ instantiates its own class as a static variable within the getter function
+ scope, instead of storing the instance as a member variable directly:
+
+ ```cpp
+ class Bad {
+ static Bad instance;
+ Bad & get_instance() { return instance; }
+ };
+
+ class Good {
+ Good & get_instance() {
+ static Good instance;
+ return instance;
+ }
+ };
+ ```
+- Member variable default values should be directly defined in the class
+ declaration instead of using the constructor.
+- Header files declare either a single class or symbols within a single
+ namespace.
## CMakeLists specific