Sha256: 44b306b13073a8e6628cdbc2ec9fd9d41c97ce2b751d19ec03e480dce3a3f726

Contents?: true

Size: 828 Bytes

Versions: 22

Compression:

Stored size: 828 Bytes

Contents

# -*- coding: utf-8 -*-


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

require 'reflex'


lines = File.readlines(__FILE__)


win = Reflex::Window.new do
  set title: "Rays/Reflex Text Test", frame: [100, 100, 600, 400]
  painter.background 0.1
  painter.font Reflex::Font.new 'Menlo', 12
  on :draw do |e|
    e.painter.push do
      linenum       = "%5d "
      linenum_width = font.width(linenum % 0).ceil
      line_height   = (font.height * 1.0).ceil

      fill 0.3
      rect 0, 0, linenum_width, 10000

      fill 1 #rand, rand, rand, 1
      lines.each.with_index do |line, i|
        text "#{linenum % i} #{line.chomp}"
        translate 0, line_height
      end
    end
  end
end


Reflex.start do
  win.show
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
reflexion-0.1.29 samples/text.rb
reflexion-0.1.28 samples/text.rb
reflexion-0.1.27 samples/text.rb
reflexion-0.1.26 samples/text.rb
reflexion-0.1.25 samples/text.rb
reflexion-0.1.24 samples/text.rb
reflexion-0.1.23 samples/text.rb
reflexion-0.1.22 samples/text.rb
reflexion-0.1.21 samples/text.rb
reflexion-0.1.20 samples/text.rb
reflexion-0.1.19 samples/text.rb
reflexion-0.1.17 samples/text.rb
reflexion-0.1.16 samples/text.rb
reflexion-0.1.15 samples/text.rb
reflexion-0.1.14 samples/text.rb
reflexion-0.1.13 samples/text.rb
reflexion-0.1.12 samples/text.rb
reflexion-0.1.11 samples/text.rb
reflexion-0.1.10 samples/text.rb
reflexion-0.1.9.1 samples/text.rb