Sha256: 060c874a6d5e86b97a1323ac62e51948f25246c1d8fd440fedc5a54aa437f441

Contents?: true

Size: 741 Bytes

Versions: 10

Compression:

Stored size: 741 Bytes

Contents

require 'rubysketch/all'


module RubySketch
  w = (ENV['WIDTH']  || 500).to_i
  h = (ENV['HEIGHT'] || 500).to_i
  WINDOW  = RubySketch::Window.new(w, h) {start}
  CONTEXT = RubySketch::Context.new WINDOW

  refine Object do
    (CONTEXT.methods - Object.instance_methods).each do |method|
      define_method method do |*args, **kwargs, &block|
        CONTEXT.__send__ method, *args, **kwargs, &block
      end
    end
  end
end# RubySketch


begin
  w, c = RubySketch::WINDOW, RubySketch::CONTEXT

  c.class.constants.each do |const|
    self.class.const_set const, c.class.const_get(const)
  end

  w.__send__ :begin_draw
  at_exit do
    w.__send__ :end_draw
    Processing::App.new {w.show}.start if c.hasUserBlocks__ && !$!
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubysketch-0.5.23 lib/rubysketch.rb
rubysketch-0.5.22 lib/rubysketch.rb
rubysketch-0.5.21 lib/rubysketch.rb
rubysketch-0.5.20 lib/rubysketch.rb
rubysketch-0.5.19 lib/rubysketch.rb
rubysketch-0.5.18 lib/rubysketch.rb
rubysketch-0.5.17 lib/rubysketch.rb
rubysketch-0.5.16 lib/rubysketch.rb
rubysketch-0.5.15 lib/rubysketch.rb
rubysketch-0.5.14 lib/rubysketch.rb