Sha256: 911d1e8e8fbd230523f481e8782a41ac762bd8a5668d17053d404cebda147da1

Contents?: true

Size: 741 Bytes

Versions: 23

Compression:

Stored size: 741 Bytes

Contents

require 'processing/all'


module Processing
  w = (ENV['WIDTH']  || 500).to_i
  h = (ENV['HEIGHT'] || 500).to_i
  WINDOW  = Processing::Window.new(w, h) {start}
  CONTEXT = Processing::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# Processing


begin
  w, c = Processing::WINDOW, Processing::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

23 entries across 23 versions & 1 rubygems

Version Path
processing-1.1 lib/processing.rb
processing-1.0.3 lib/processing.rb
processing-1.0.2 lib/processing.rb
processing-1.0.1 lib/processing.rb
processing-0.5.34 lib/processing.rb
processing-0.5.33 lib/processing.rb
processing-0.5.32 lib/processing.rb
processing-0.5.31 lib/processing.rb
processing-0.5.30 lib/processing.rb
processing-0.5.29 lib/processing.rb
processing-0.5.28 lib/processing.rb
processing-0.5.27 lib/processing.rb
processing-0.5.26 lib/processing.rb
processing-0.5.25 lib/processing.rb
processing-0.5.24 lib/processing.rb
processing-0.5.23 lib/processing.rb
processing-0.5.22 lib/processing.rb
processing-0.5.21 lib/processing.rb
processing-0.5.20 lib/processing.rb
processing-0.5.19 lib/processing.rb