Sha256: 7a41ae8d14849c72fa4fb11f3393219cc7d35347bf095f37cc4d519265018ad9

Contents?: true

Size: 743 Bytes

Versions: 22

Compression:

Stored size: 743 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'


class CheckerWindow < Reflex::Window

  def initialize ()
    super
    set :title,  "Hello Reflex!"
    set :frame, 100, 100, 320, 240
    painter.font = Reflex::Font.new nil, 32
    painter.background = 1
  end

  def on_draw (e)
    p, size, count = e.painter, 10, 16
    count.times do |x|
      count.times do |y|
        next if (x + y) % 2 == 0
        p.fill = x.to_f / count, y.to_f / count, 1
        p.rect x * size, y * size, size - 1, size - 1
      end
    end
  end

end# CheckerWindow


Reflex.start do
  CheckerWindow.new.show
end

Version data entries

22 entries across 22 versions & 1 rubygems

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