Skip to content

docs: Add code conventions #201

@faretek1

Description

@faretek1

Add name conventions e.g.

PascalCase: struct, enum, struct constructor macro
snake_case: var, list, broadcast, costume, proc, func, %include, sprite
SCREAMING_SNAKE_CASE: macro (%define)

Also add conventions like code ordering

%include inflator/cmath

%define PI_YAY 3.14159265358979323

costumes "blank.svg";
sounds "meow.wav";

struct Vec2 {
	x, y
}

%define Vec2(x, y) (Vec2{x: x, y: y})

proc main {
	Vec2 v = Vec2(1, 2);
	log v.x & ", " & v.y;
	log PI_YAY & " is cool!";
}

onflag {
	main;
}

i.e.

  1. includes & macros for compile time library customisation
  2. Const macros
  3. costumes and sounds
  4. general macros
  5. structs
  6. procs & funcs
  7. onflag and other hat blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions