2 ms·
Unless it's an arcade machine like Bombjack which has two Z80s and three AY sound chips ;) It's still possible to wrap all that as nested state in a single glo
by flohofwoe 2y ago
Unless it's an arcade machine like Bombjack which has two Z80s and three AY sound chips ;)
It's still possible to wrap all that as nested state in a single global, and it works just fine:
https://github.com/floooh/chips-test/blob/613dbfe907104f4110681a6c883c23c9c5cdb4e8/examples/sokol/bombjack.c#L38-L47 https://github.com/floooh/chips-test/blob/613dbfe907104f4110...
That's a single mutable global with all application state, but inside that global are nested structs and the code working on those structs takes essentially a 'this' pointer. This approach works well since it enforces a strictly hierarchical code and data structure with a single root-struct (and also a single root-source-file) at the top.