require 'ruby2d' set title: '5' set width: 100 set height: 100 set background: 'yellow' on :mouse_down do |e| if e.button == :left set background: 'red' elsif e.button == :right set background: 'green' end end on :mouse_scroll do |e| set background: 'yellow' end show