stackless coroutines for gamedev in ~200 lines of C++

12 points by LesleyLai


fanf

This is a twist on Simon Tatham’s coroutine trick with a notable difference that’s kind of buried in the middle:

You might be wondering: why __COUNTER__ and not __LINE__?

I specifically chose not to use __LINE__, and the reason is serialization.

That works only if the integer means the same thing across save and load.

Any cosmetic edit to the source file shifts those numbers.