You can see me attempt to use this pattern in New Game?: Dungeon Crawl
I am thinking of expanding this with a State abstract class that has two functions:
In a second phase, I would like to replace
loop with several event callback functions like
And then have a separate
animationLoop function intended for animating the blink for it’s current state.
I think if done right and with preventing dynamic allocation, this could help make blinks programming even more accessible.
Preventing dynamic allocation: https://en.m.wikibooks.org/wiki/More_C%2B%2B_Idioms/Requiring_or_Prohibiting_Heap-based_Objects
The intent is for all
State class subclasses to be singletons that are only allocated statically.
I also need to learn more about the
faceValueChange callbacks might be tricky, though there is already debouncing happening around the click count flag functions.
This is all assuming that this is no worse performance wise to the current loop and flag check paradigm of the current SDK.