summaryrefslogtreecommitdiffhomepage
path: root/tests/input.rb
blob: 31f1527ff4441dab2f1c9626aeb2fdede59d173f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'ruby2d'

set width: 200, height: 100, title: "Ruby 2D – Input"

on key: 'a' do
  puts "a key"
end

on key_down: 's' do
  puts "s key down"
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

show