I'm developing a game using polling for the input method. However, now that I'm delving deeper into the game menus and other UI components, I'm finding that I'd probably like to have event driven input. Perhaps even having both, using event driven for the UI and polling for the "world" input. I'm curious on what the best way to go is.
I'm defining polling as: each update loop I check what keys are press, where the mouse is, buttons pressed, then run through them and do actions based on the info collected.
I'm defining event driven as: interrupt based events, when an event happens and interrupt is triggered and a code block is run based on the event.
Do you think it's best to go all event driven, all polling, or is a combination of both acceptable? If you have pros and cons for either please list them. Thanks.
EDIT
The game is Java/OpenGL based, so will be released to Windows/Mac/Linux. The possibility of extending that to mobile devices is low. The game is RTS style, 3rd person 3D.
EDIT 2
I'm still not totally happy with the way I've implemented this, but what I'm moving toward is catching events in my UI and if they're not handled by any of my UI components, I pass the event on to the "World" for picking/selection. Something like:
@Override
private boolean handleEvent(Event event) {
if(hud.handleEvent(event)) {
return true;
}
return WORLD.handleEvent(event);
}
This way I don't get clicks leaking through the UI to select objects behind buttons and what not.
Currently my camera controls are still based on polling, and that seems to be working for now, but I may update that later on.
I appreciate all the answers, sorry I could only pick one!