Sha256: bd15381a5ddcea90aa6dbab43c73caf757dfde6283e72f5a411c8221ee04228e

Contents?: true

Size: 775 Bytes

Versions: 3

Compression:

Stored size: 775 Bytes

Contents

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


%w[xot rays reflex].product(%w[ext lib]).each do |paths|
  $: << File.expand_path(
    File.join File.dirname(__FILE__), *%w[.. .. ..], *paths)
end

require 'rubygems'
require 'reflex'


class CheckerWindow < Reflex::Window

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

  def draw ()
    count = 16
    size  = 10
    paint do |p|
      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

end# CheckerWindow


CheckerWindow.new.show
Reflex.run

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reflexion-0.1.6 examples/ruby/checker.rb
reflexion-0.1.5 examples/ruby/checker.rb
reflexion-0.1.4 examples/ruby/checker.rb