ScriptLineStudios / waphics.c

A web browser video game library for C.
https://waphicsc.readthedocs.io/en/latest/index.html
MIT License
3 stars 1 forks source link

Understanding the `render` function #7

Open sDos280 opened 1 year ago

sDos280 commented 1 year ago

So lately have been trying to understand how the render function works. It seem that the render function used as a game loop, but I still seem to not understand one thing.

The it seems that the render returns uint32_t * which is basically a place in memory for the surface screen. Nevertheless it seems a bit weird to return the same place in memory again and again. It may make more sense to just add a function that will be called once and will send the position ones(in the initialization step in JavaScript)... If we will be able to do that we may be able to "compress" the render and init to one function that will basically just be a main function and just use a while loop (like using emscripten_set_main_loop) to achieve the same result.

Do you think that is possible?