Before start, i want apologize for my poor english.
Well, I'm a beginner programmer and recently I've taken interest in game programming.
So now, i'm a little concerned about the event-handling (or event-management). Next on, i'll put a python-code as example:
def main():
"""Main module"""
initGame()
while True:
catchGameEvents()
updateGameState()
drawGameState()
def catchEvents():
"""Right here we intercept all user input events and dispatch them
throught all game entities"""
for event in pygame.event.get():
if event.type == QUIT:
sys.quit() #It's part of game logic, right?
elif event.type == KEYUP:
if event.key == UP:
#Manage game logic?
if event.key == DOWN:
#Manage game logic?
if ... #so on
As I know, the previous code mixes game logic and events and I'd like to separate both things.
Trying to resolve this problem, i was searching for an oriented-object solution and I found this: http://ezide.com/gam...ing-games.html. It essentialy solves the problem, but it seems to me very "objected" and a little tricky (and long-term slow???).
How I could resolve this issue?
Thank you!