RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

Gosu-Keyboard - An easy DSL for handling keyboard events in Gosu

gosu-keyboard - A DSL for easily handling keyboard events within a Gosu::Window.

Small example:
Gosu::Keyboard.handle_keys(@gosu_window) do
down?(escape) { close }
down?(left && !shift) { @player.walk(:left) }
down?(right && !shift) { @player.walk(:right) }
down?(left && shift) { }
down?(right && shift) { }
down?(!left && !right) { @player.stand }


Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!