Skip to content

Code Naming Convention

Michael edited this page Jun 13, 2020 · 2 revisions

Each of the main Emu classes use PascalCase as their naming convention (EmuInput, EmuButton, EmuColorPicker, etc). The inner methods contained in the classes also use PascalCase (element.GetHeight(), list.GetSelection(), etc).

Struct variables are snake_case.

GML does not currently support variable access modifiers, but as a general rule all of the values of the UI elements which need to be accessed by the outside world should be set via the associated method. This is both to indicate which values are safe to change, and because elements may need to perform other actions automatically as a result of having their values updated (e.g. rearranging radio options accordingly when setting columns of an EmuRadioArray.

There are a number of methods which are not relevant to the outside program (i.e. private methods and callbacks). Pseudo-private methods use camelCase. Callbacks use snake_case. The general rule is that if a property of a class does not start with a capital letter, it should not be of interest to the outside program.

There are also a handful of pseudo-private classes, which are also snake_case.

Enums are PascalCase, but are prefixed with E_ to differentiate them from classes. Enum members and most other constant values are uppercase SNAKE_CASE.

If you look through the code, you may notice some locally-scoped variables prefixed with an _underscore but others are not. This is totally inconsistent and I should probably change it eventually, but hopefully this is nobody's problem but mine.

Clone this wiki locally