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) { @player.run(:left) }
down?(right && shift) { @player.run(:right) }
down?(!left && !right) { @player.stand }
end</pre>
Post a comment