While working on TI-Trek, I found that an event-based system made networking within the game a lot more stable. I began work on a custom event library, mostly to use within Trek, but the API is public and the library can be used by anyone who needs to implement events into their projects.
The source code/headers/lib file can be found here: https://github.com/acagliano/eventlib-ce/tree/stable with the latest version available for download from the Releases. Note that while it is tested, it is not tested extensively and may have some issues... please report them on the Github.
The API allows you to Register an event consisting of an event identifier, a callback function, and optional callback data. The callback data is passed by copy (via malloc) to ensure it is in scope at the time of the execution. The registration returns the slot id of the registered event so that in future you may delete or modify the slot if necessary. You can also enable and disable watching for particular events, trigger an event in code, purge all registrations of a certain event, and check for triggered events.
For a full API overview, see: https://acagliano.github.io/eventlib-ce/
Any suggestions, recommendations, or criticisms, feel free to comment.
The source code/headers/lib file can be found here: https://github.com/acagliano/eventlib-ce/tree/stable with the latest version available for download from the Releases. Note that while it is tested, it is not tested extensively and may have some issues... please report them on the Github.
The API allows you to Register an event consisting of an event identifier, a callback function, and optional callback data. The callback data is passed by copy (via malloc) to ensure it is in scope at the time of the execution. The registration returns the slot id of the registered event so that in future you may delete or modify the slot if necessary. You can also enable and disable watching for particular events, trigger an event in code, purge all registrations of a certain event, and check for triggered events.
For a full API overview, see: https://acagliano.github.io/eventlib-ce/
Any suggestions, recommendations, or criticisms, feel free to comment.