Sha256: c2a8575e856e264c4485d7f27e64cf97cd3e9f2a3f148e1b2d58f60d266a8f96

Contents?: true

Size: 1.01 KB

Versions: 27

Compression:

Stored size: 1.01 KB

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'


win = Reflex::Window.new do
  set title: "Grid Test", frame: [100, 100, 50, 50]
  painter.background 0

  on :draw do |e|
    p = e.painter
    p.push

    w, h = frame.size.to_a

    p.fill 1, 0, 0

    p.rect 1, 1, 5, 5

    p.stroke 0.3, 0.4
    (0..frame.width) .step(2).each {|x| p.line x, 0, x, h}
    (0..frame.height).step(2).each {|y| p.line 0, y, w, y}
    p.stroke 0.5, 0.4
    (0..frame.width) .step(10).each {|x| p.line x, 0, x, h}
    (0..frame.height).step(10).each {|y| p.line 0, y, w, y}

    p.translate 3, 10, 0
    p.fill nil
    p.stroke 1

    p.line 0, 0, 5, 0

    p.translate 0, 10, 0

    p.rect 0, 0, 5, 5

    p.translate 0, 10, 0
    p.fill 0.5, 0.5, 1
    p.stroke nil

    p.rect 0, 0, 5, 5

    p.translate 0, 10, 0
    p.fill 0.5, 0.5, 1
    p.stroke 0.5, 1, 0.5

    p.rect 0, 0, 5, 5

    p.pop
  end
end


Reflex.start do
  win.show
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
reflexion-0.3.2 samples/grid.rb
reflexion-0.3.1 samples/grid.rb
reflexion-0.3 samples/grid.rb
reflexion-0.2.1 samples/grid.rb
reflexion-0.2 samples/grid.rb
reflexion-0.1.57 samples/grid.rb
reflexion-0.1.56 samples/grid.rb
reflexion-0.1.55 samples/grid.rb
reflexion-0.1.54 samples/grid.rb
reflexion-0.1.53 samples/grid.rb
reflexion-0.1.52 samples/grid.rb
reflexion-0.1.51 samples/grid.rb
reflexion-0.1.50 samples/grid.rb
reflexion-0.1.49 samples/grid.rb
reflexion-0.1.48 samples/grid.rb
reflexion-0.1.47 samples/grid.rb
reflexion-0.1.46 samples/grid.rb
reflexion-0.1.45 samples/grid.rb
reflexion-0.1.44 samples/grid.rb
reflexion-0.1.43 samples/grid.rb