Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Question about event handling

Name: Anonymous 2014-06-21 11:42

Let's say I use SDL (1.2 or 2.0) in my program to handle events, should I use callbacks or the good old giant switch statement?

Name: Anonymous 2014-06-23 7:06

>>87
Second I am asking for a better solution since it feels ``shitty''

If you think this is shitty, just do the easiest thing you can think of, but keep in mind you might have to change your strategy. Event handling is going to need a lot of your attention to get right.

You've got about 16ms each frame to do all the logic and render the frame. That's about 64 million instructions on a modern machine. You could do events in O(n²) and it's not going to amount to much of that. So do what is easiest to debug and forget about how fast it is. If you start dropping frames profile before you optimize or you will end up optimizing the wrong thing.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List