If you were going to develop a game in say, Ruby, and you were provided with a game framework, would you rather act on key up/down events by overloading a method on the main window like so:
class MyGameWindow < Framework::GameWindow
def button_down(id)
case id
when UpArrow
do_something
when DownArrow
do_something
end
end
end
Or have an event class with which you can make a method and assign a handle to it, like so:
class MyGameWindow < Framework::GameWindow
def initialize
key_down.add_handler(method(:do_something))
end
def do_something
puts "blah blah"
end
end
Please give your views, which do you think would be better in a game developement area, and thanks in advance, ell.