Naming Conventions

The following page describes spectras naming conventions.

Generic

Usually, abbreviations are not used unless they are extremely common and obvious, and the words they replace are substantially longer than the abbreviation.

Example:

calcDerivative()
evalExpression()

This is a fairly rare occurrence in the engines source however, so its recommended to keep the use of abbreviations to a minimum.

In addition, variables are almost always written in full. The only exception for this is in for loops.

Example:

int i; // Instead of: int index

Classes

Classes start with an uppercase letter and remain lowercase until another word follows.

Example:

class RenderUtils {
   // Some code
}

Functions

Both function names as well as arguments follow the same convention as Variables although they remain the same when a function is a constexpr.

Example:

Variables

Variables start with a lowercase word. Any subsequent words start with an uppercase letter.

Example:

Another thing you might notice is that for variables that store some sort of id, the ID is often capitalized. This is mainly for aesthetic reasons, and to make clear that it is an identifier and not some other abbreviation with id.

Enums

Enums are fully uppercase and prefixed with ST.

Example:

Structs

Structs follow a similar convention as Variables although they remain the same when a function is a constexpr. They are always prefixed with a lowercase "st" and suffixed with "Info". Like this:

Last updated