Sha256: 912fd0e06fe128ad7d2212a9c0c9d4f942926b6304a09897103ce2954d8ce30d

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 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)
      .reject {_1 =~ /__$/} # methods for internal use
      .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.reject {_1 =~ /__$/}.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

3 entries across 3 versions & 1 rubygems

Version Path
processing-1.1.3 lib/processing.rb
processing-1.1.2 lib/processing.rb
processing-1.1.1 lib/processing.rb