I'm trying to implement a little ECS in C with raylib, but I keep running into problems with how to organize everything. C doesn't have classes or the ability to link functions and stuctures, so I'm not sure how to do basic things like set up an entity manager. If there are some C patterns that I just don't know about and should be using, or if anyone has suggestions on places to look for help, it would be very much appreciated!
@flbr yeah the basic pattern is that the first parameter of all your functions is a pointer to a structure named *ctx whose type is whatever “class” the function operates on. one “class” per file.
@flbr so you’d define the struct at the top of each file and then functions that act upon it all taking StructName *ctx as first parameter
@flbr you’d also of course have create and destroy functions for allocating, initialising and freeing ctx objects and returning pointers
@flbr one neat little consequence of this pattern is that “static”variables in c end up acting a lot like static properties in c++; variables scoped to the “class”
Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.