Sha256: 7f06cd6bb8a137a6db5827c5d0c748bc58a0b478fbc81277bfd764352f4d884a

Contents?: true

Size: 807 Bytes

Versions: 23

Compression:

Stored size: 807 Bytes

Contents

%w[xot rays reflex]
  .map  {|s| File.expand_path "../../#{s}/lib", __dir__}
  .each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}

require 'reflex'


$text = $pos = ''


w = Reflex::Window.new
w.title = "Reflex Input Sample"
w.frame = 100, 100, 800, 300
w.painter.font = Reflex::Font.new nil, 32

w.on :draw do |e|
  p = e.painter
  p.fill = 1
  p.text $text, 100, 100
  p.text $pos, 100, 150
end

w.on :key_down do |key|
  $text += key.chars
  $text = $text[-10..-1] if $text.size > 10
  p [key.chars, key.code, key.repeat, key.modifiers]
  w.redraw
  w.close if key.code == 53
end

w.on :pointer_move do |points|
  $pos = "#{points.x}, #{points.y}"
  p [points.type, points.x, points.y, points.size, points.modifiers, points.count, points.drag]
  w.redraw
end

Reflex.start do
  w.show
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
reflexion-0.2 samples/key.rb
reflexion-0.1.57 samples/key.rb
reflexion-0.1.56 samples/key.rb
reflexion-0.1.55 samples/key.rb
reflexion-0.1.54 samples/key.rb
reflexion-0.1.53 samples/key.rb
reflexion-0.1.52 samples/key.rb
reflexion-0.1.51 samples/key.rb
reflexion-0.1.50 samples/key.rb
reflexion-0.1.49 samples/key.rb
reflexion-0.1.48 samples/key.rb
reflexion-0.1.47 samples/key.rb
reflexion-0.1.46 samples/key.rb
reflexion-0.1.45 samples/key.rb
reflexion-0.1.44 samples/key.rb
reflexion-0.1.43 samples/key.rb
reflexion-0.1.42 samples/key.rb
reflexion-0.1.41 samples/key.rb
reflexion-0.1.40 samples/key.rb
reflexion-0.1.39 samples/key.rb