diff options
| author | Tom Black <[email protected]> | 2017-03-01 19:31:53 -0500 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2017-03-01 19:31:53 -0500 |
| commit | e185d0cfc03f3907b0c55c226b5d51a0a4757dac (patch) | |
| tree | b4ad32783077306acaa5b97d27aadb282c8d6291 | |
| parent | 83b2558522e61545d013bb07bcd6b7d364444855 (diff) | |
| download | ruby2d-e185d0cfc03f3907b0c55c226b5d51a0a4757dac.tar.gz ruby2d-e185d0cfc03f3907b0c55c226b5d51a0a4757dac.zip | |
Update input tests
Reflecting current API
| -rw-r--r-- | test/input.rb | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/test/input.rb b/test/input.rb index 9c8d7b2..82bce4a 100644 --- a/test/input.rb +++ b/test/input.rb @@ -1,17 +1,17 @@ require 'ruby2d' -set width: 200, height: 100, title: "Ruby 2D – Input" +set width: 200, height: 100, title: "Ruby 2D — Input" on key_down: 'a' do - puts "Key 'a' pressed" + puts "Key 'a' down" end -on key: 'a' do - puts "Key 'a' held down" +on key: 'b' do + puts "Key 'b' held down" end -on key_up: 'a' do - puts "Key 'a' released" +on key_up: 'c' do + puts "Key 'c' up" end on key_down: 'any' do @@ -19,27 +19,13 @@ on key_down: 'any' do end on_key do |key| - puts "on_key: #{key}" + if key == 'd' + puts "on_key: #{key}" + end end -on mouse: 'left' do - puts "mouse left" -end - -on mouse: 'right' do - puts "mouse right" -end - -on mouse: 'down' do - puts "mouse down" -end - -on mouse: 'up' do - puts "mouse up" -end - -on mouse: 'any' do - puts "mouse any" +on mouse: 'any' do |x, y| + puts "Mouse clicked at: #{x}, #{y}" end on key: 'escape' do |
