Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Code Guideline

Matěj Štágl edited this page Feb 11, 2019 · 2 revisions

Welcome to the Code Guideline section of the Manual. This is one-page document explaining basic code rules when using Simplex Engine. Consult this document at any time thoroughly.

Brackets

The only way brackets should be used. Both brackets are on a new line, code inside a block is offseted by one tab, which is set to 4 spaces.

if (something) 
{
 // 1 tab (4 spaces)
}

Variables

Variables are always names using camel case, starting with a small letter.

int myVariable = 1;
Vector2 myVector = Vector2.Zero;

Attributes

Always name attributes using camel case, staring with a capital letter.

int MyAttribute {get; set;}

Internal variables

Always prefix internal variables with underscore, continue camel case starting with a small letter

private int _myInternal;
public int MyPublic 
{
 get 
 {
 return _myInternal;
 }
 
 set
 {
 _myInternal = value;
 }
}

Methods

Always name methods with camel case, starting with a capital letter. Always insert a space after a comma in a method call / definition.

public int Sum(int a, int b)
{
 return a + b;
}

Interfaces

Always prefix an interface with I, following with camel case with a capital first letter.

interface ISomething
{
 int a;
 int b;
}

SGML Commands

Always use snake case for naming sgml commands, preserve namespaces in naming.

public int library_sum(int a, int b)
{
 return a + b; 
}

Classes

Always name your properties with a camel case, starting with a capital letter

public class MyClass
{
}

Properties

Always name your properties with a camel case, starting with a capital letter

public class MyClass
{
 public int PropertyA;
 public int PropertyB;
}

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /