Standards and Conventions - skytreader/PyGame-Objects GitHub Wiki

For compliance of the rest of the codebase.

Geometric Points

When a method or function requires geometric point as input, take in a tuple so as to make it easily extendable for higher-dimensions.

They will always be specified as (width, height) for sizes or (row, col) for actual coordinates. But keep in mind that (row, col) translates to (y, x) in the Cartesian Plane (or (-y, x), depending on how you want to be pedantic about it).

An exemption is when the class/method requiring it already makes explicit assumptions on the dimensionality of data.

Drawing Rectangles

To lessen cognitive overload from vanilla PyGame, rectangles are always described as (upper_left_x, upper_left_y, block_width, block_height). Classes which abstract rectangles should provide a way to express/convert the abstractions into this form.

Variable/parameter naming

window refers to a Pygame surface, specifically one returned by pygame.display.set_mode.

screen refers to an instance of components.core.GameScreen.

Returning iterables

If the order of the items does not matter return a set. Otherwise, return a tuple or a list. If modifications are not expected, prefer tuples over lists, especially if it is just a compilation of constant literals; this provides a speed advantage.