I was wandering if you could offer any guidance. I am currently writing a sprite class for a simple game engine. Previous engines I have used allow functionality to "Connect" an external function to a signal, emitted when an animation finishes.
E.g.
- create the sprite object
- create the external function
- connect the external function to the sprites completion signal
- When the signal is emitted the external function is called.
This function does not necessarily share any data with the sprite, its purely game logic timing functionality. E.g player scores a goal, "Congrats" sprite animation is triggered, then the on completion function will add an amount to the players score.
I have looked into it and it looks like I need to use a callback function/ function ptr but I don't have any experience using them as of yet.
Any help would be greatly appreciated.