Sha256: bd237b536f0c10a799909e9a6d2c4d7fb1e44a124ba6887a9d42b51cfe08f819
Contents?: true
Size: 861 Bytes
Versions: 3
Compression:
Stored size: 861 Bytes
Contents
# -*- coding: utf-8 -*- %w[rays reflex].product(%w[ext lib]).each do |paths| $: << File.expand_path( File.join File.dirname(__FILE__), "..", "..", "..", *paths) end require 'rubygems' require 'reflex' $text = $pos = '' w = Reflex::Window.new w.title = "Reflex Input Sample" w.bounds = 100, 100, 800, 300 w.painter.font = Rays::Font.new nil, 32 w.on :draw do w.paint do |p| p.fill = 1 p.text $text, 100, 100 p.text $pos, 100, 150 end end w.on :key_down do |obj, key| w.close if key.code == 53 $text += key.chars $text = $text[-10..-1] if $text.size > 10 p [key.chars, key.code, key.repeat, key.modifiers] w.redraw end w.on :points_moved do |obj, points| $pos = "#{points.x}, #{points.y}" p [points.type, points.x, points.y, points.size, points.modifiers, points.count, points.drag] w.redraw end w.show Reflex.run
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reflexion-0.1.3 | examples/ruby/key.rb |
reflexion-0.1.2 | examples/ruby/key.rb |
reflexion-0.1.1 | examples/ruby/key.rb |