Should I use events in this case?
- by joon
I'm creating a video player, like a custom YouTube player.
All of the GUI elements (progress bar, video player, play button, ...) are different classes, but I obviously need them to communicate. When the progress bar is clicked, or the slider is moved, it needs to send a "seek(x)" command to the video player. Similarly, the video player needs to update the progressbar every frame.
Currently I'm doing this by having almost all elements have a link to each other.
So when I create the progress bar, I'm telling it where the video player is.
But after a while this becomes more and more complicated, and I'm wondering if events would be a better way to do this. Or a main controller class that has all the connections.
What should I do?