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