Examples: refactor all examples with a MainLoopStep() function, to facilitate use with Emscripten. (#2492, #3699) Aligned all examples.