HandmadeHero/docs/Day 017.md

14 lines
1.3 KiB
Markdown
Raw Normal View History

2023-09-21 23:16:40 -07:00
# Day 17
Talks about functional programming. Mostly an emphasis of not abusing global state fields or constricting the interface a state may be musted from. With the 'ideal' if performance is not heavily impacted is to use a pure function.
Like I said in Day 14 however I do want to setup a less stack-spam way to pass around data for ergonomics, so instead I'll be using static analysis with gencpp to make sure they are only used in the correct places (there will be a list of function names that are allowed to use the global state, and if it is used in any other function it will throw an error, preventing handmade from compiling).
I wish Casey used the `GetAsyncKeyState` instead of this window messaging.
(I'll be using it, not a fan of getting input callbacks from the window)
I didn't do iteration accross all controllers, I'll worry about that when I setup multiple players.
When it comes to the "controller stick averaging" and abstracting that to actions (like he did) hes bleeding into what should really be an input system with bounded actions, but he doesn't want to make an input system (so its just rapid hardcoding).
I'll do the averaging on the platform layer (for now) since it simple, but like said previously, I will not be allowing the engine layer to abstract what API devices are assigned to a "controller".