Skip to content

Coding Guidelines

Aditya Gaddam edited this page Dec 18, 2020 · 1 revision

This is a loose set of guidelines for code.

General Ethos

KABUKI isn't meant to be the next unreal or unity. As such, keep features to sensible defaults instead of polluting the code with massively expansive options to try and handle every situation.

Naming

  • Classes, methods, variables etc. should be all lowercase with words separated with underscores.
  • Private member variables have a leading underscore.

Example:

class window : public engine_component

SDL_Window *_sdl_window;

Braces

  • Always use braces. Even one line if statements.
  • Braces should have their own line, unless it's a simple one liner.

Example:

if(width == 0 && height == 0)
{
    width = dm.w;
    height = dm.h;
}

or

bool is_running() { return _is_running; }

Smart Pointers

Prefer the use of smart pointers as much as possible. Specifically, try to generate and use std::unique_ptr when possible.

Clone this wiki locally