40 lines
1.3 KiB
Markdown
40 lines
1.3 KiB
Markdown
# Dice GUI
|
|
|
|
A simple dice rolling GUI app using Clay for layout, Ceramic elements and SDL3 rendering.
|
|
|
|
# Compiling
|
|
|
|
Either `git clone --recursive` or remember to `git submodule update --init --recursive`. Then `cmake -S. -Bbuild` and `cmake --build build`. Which compiles `bin/dice-gui`, which you can run.
|
|
|
|
# Code Standards
|
|
|
|
* Keep program structure as simple as possible. No `class Application` or other Java-isms. Prefer namespaces with static lifetime variables.
|
|
|
|
* Use STL where possible. Don't reinvent the wheel.
|
|
|
|
* K&R brackets. With notable exceptions(1)
|
|
|
|
* camelCase for variables, PascalCase for types and functions (that's what SDL and Clay do).
|
|
|
|
* In class member functions, always use `this->` to access member variables.
|
|
|
|
* `const` applies to the name to it's left, so it goes after the type, not `const int x;` but `int const x`.
|
|
|
|
* \* and & flush with the declaration name. `Type const &Function(Type &inRef)`
|
|
|
|
> (1) Bracket exceptions:
|
|
> * using scoped_lock in arbitrary blocks, prefer tailed lisp brackets
|
|
|
|
```cpp
|
|
struct Data {
|
|
int x{ 0 }, y{ 0 };
|
|
};
|
|
void MyFunction(Data const &data) { // K&R here
|
|
DoAsynchronousThings();
|
|
{ std::scoped_lock lock{ myMutex };
|
|
myVariable++;
|
|
} // not quite lisp, lisp with a tail
|
|
DoMoreAsynchronousThings();
|
|
}
|
|
```
|