summaryrefslogtreecommitdiffhomepage
path: root/test/input.rb
diff options
context:
space:
mode:
authorTom Black <[email protected]>2016-12-24 22:17:34 -0600
committerTom Black <[email protected]>2016-12-24 22:17:34 -0600
commite81d32b470cdead1c114b6d1b5b6bda958d6b1ad (patch)
tree3d61e376c8f460b2ff932cb9f9104f2e0cf5b72e /test/input.rb
parent326b74d485ce81c0a4e1da0e5158a2c83e028915 (diff)
downloadruby2d-e81d32b470cdead1c114b6d1b5b6bda958d6b1ad.tar.gz
ruby2d-e81d32b470cdead1c114b6d1b5b6bda958d6b1ad.zip
Merge all tests into `test/` directory
Diffstat (limited to 'test/input.rb')
-rw-r--r--test/input.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/input.rb b/test/input.rb
new file mode 100644
index 0000000..9c8d7b2
--- /dev/null
+++ b/test/input.rb
@@ -0,0 +1,49 @@
+require 'ruby2d'
+
+set width: 200, height: 100, title: "Ruby 2D – Input"
+
+on key_down: 'a' do
+ puts "Key 'a' pressed"
+end
+
+on key: 'a' do
+ puts "Key 'a' held down"
+end
+
+on key_up: 'a' do
+ puts "Key 'a' released"
+end
+
+on key_down: 'any' do
+ puts "A key was pressed"
+end
+
+on_key do |key|
+ puts "on_key: #{key}"
+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"
+end
+
+on key: 'escape' do
+ close
+end
+
+show