Sha256: 962da2b7ac8ba50cc9de00e20d9f784fdc057a590d7196c1de8dc04eb7bbc4d9

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

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

include Reflex


win = Window.new do
  image = Image.new(32, 32).tap do |img|
    img.paint do
      color :white
      rect img.bounds
      color :red
      ellipse img.bounds.inset_by(2, 2)
    end
  end

  256.times do
    add ImageView.new {set data: image}
  end

  on :update do
    redraw
  end

  after :draw do |e|
    e.painter.color :blank do
      rect 0, 0, 100, 40
      fill :white
      text "#{e.fps.to_i} FPS", 10, 10
    end
  end

  set title: 'Many Image Views', frame: [100, 100, 500, 400]
end


Reflex.start do
  win.show
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reflexion-0.1.12 samples/image.rb
reflexion-0.1.11 samples/image.rb
reflexion-0.1.10 samples/image.rb
reflexion-0.1.9.1 samples/image.rb
reflexion-0.1.9 samples/image.rb
reflexion-0.1.8 samples/image.rb