Skip to content

Latest commit

 

History

History
71 lines (51 loc) · 1.48 KB

File metadata and controls

71 lines (51 loc) · 1.48 KB

Files

Each .h / .c duo should have one clear job.

/runtime

What launches your game

/tests

Temp tests used throughout the dev process

/benchmark

critical speed test projects

/ressources

ressources for project system

/scripts

scripts for build system etc ..

/grngame

/web

Tools for the web

/assets

Loading/unloading multiple types of assets

/audio

Playing sound

/physics

2D platformer physics

/input

Manages inputs received from the window

/platform

Wrappers over OS specific functionality (eg. filepaths)

/math

Functions and utilites related to math that are not found in cglm

/bindings

Binding everything to Wren

/renderer

Rendering related functions and structs

/data

sqlite , file system , json etc ...

Naming conventions

Casing

  • Types: PascalCase
  • Fonctions: PascalCase
  • Macros: UPPER_SNAKE_CASE
  • Autre: snake_case

Naming

Functions that operate a struct or are part of a "module" are "noun first", examples:

  • WindowCreate
  • PhysicsTick
  • AudioLoad

Error handling

Always handle errors or at least have a // TODO: handle.

Misc

  • Ideally a function should not be longer than 15 lines
  • If something can be extracted to a utility function, do it, and if the contents of the functions could be reused somewhere, place it somewhere appropriate and make it public
  • No logical operation should be split accross multiple files (or even functions)
  • You can break rules if it helps readability