-
-
Notifications
You must be signed in to change notification settings - Fork 20
Code Guideline
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.
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 are always names using camel case, starting with a small letter.
int myVariable = 1; Vector2 myVector = Vector2.Zero;
Always name attributes using camel case, staring with a capital letter.
int MyAttribute {get; set;}
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; } }
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; }
Always prefix an interface with I, following with camel case with a capital first letter.
interface ISomething { int a; int b; }
Always use snake case for naming sgml commands, preserve namespaces in naming.
public int library_sum(int a, int b) { return a + b; }
Always name your properties with a camel case, starting with a capital letter
public class MyClass { }
Always name your properties with a camel case, starting with a capital letter
public class MyClass { public int PropertyA; public int PropertyB; }