raysan5 / raylib-game-template

A small template to start your raylib game
zlib License
389 stars 91 forks source link

[Cleanup] use C code that is also compatible with C++ #12

Closed JeffM2501 closed 1 year ago

JeffM2501 commented 1 year ago

While the template is valid C code, it does not work well when converted to C++. Some users would like to use the template as the starting point for C++ code.

This PR makes a few small changes to the C code to make it also compatible with C++.

1) use the scene enums everywhere, not a mix of enums and numbers (also makes the code read better) 2) don't pass the address of unnamed temp variables into functions, allocate an actual structure.

These changes allow the c files to be simply renamed C++ and compile without issues.

raysan5 commented 1 year ago

@JeffM2501 Thanks! I'm used to use integers for enum types, maybe it's about time to change to a stronger typeage mode... :)