summaryrefslogtreecommitdiffhomepage
path: root/tests/input.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/input.rb')
-rw-r--r--tests/input.rb40
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/input.rb b/tests/input.rb
index 31f1527..fbf0530 100644
--- a/tests/input.rb
+++ b/tests/input.rb
@@ -3,11 +3,41 @@ require 'ruby2d'
set width: 200, height: 100, title: "Ruby 2D – Input"
on key: 'a' do
- puts "a key"
+ puts "on key: 'a'"
end
-on key_down: 's' do
- puts "s key down"
+on key_up: 's' do
+ puts "on key_up: 's'"
+end
+
+on key_down: 'd' do
+ puts "on key_down: 'd'"
+end
+
+on key: 'any' do
+ puts "on key: 'any'"
+end
+
+on key_down: 'any' do
+ puts "on key_down: 'any'"
+end
+
+on key_up: 'any' do
+ puts "on key_up: 'any'"
+end
+
+on_key do |key|
+ puts "on_key: #{key}"
+end
+
+on_controller do |which, is_axis, axis, val, is_btn, btn|
+ puts "=== Controller Pressed ===",
+ "which: which",
+ "is_axis: #{is_axis}",
+ "axis: #{axis}",
+ "val: #{val}",
+ "is_btn: #{is_btn}",
+ "btn: #{btn}"
end
on mouse: 'left' do
@@ -30,4 +60,8 @@ on mouse: 'any' do
puts "mouse any"
end
+on key: 'escape' do
+ close
+end
+
show