Sha256: 58611c5231750d4f9e587c2defff8f515fbf23b46d56b0ed183e483bb7916312

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

# -*- coding: utf-8 -*-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'ruby-processing'

# redefine Processing::App#initialize so that dose not run sketch.
class Processing::App
  def initialize(options={})
    super()
    $app = self
    proxy_java_fields
    set_sketch_path
    mix_proxy_into_inner_classes

    java.lang.Thread.default_uncaught_exception_handler = proc do |thread, exception|
      puts(exception.class.to_s)
      puts(exception.message)
      puts(exception.backtrace.collect { |trace| "\t" + trace })
      close
    end

    args = []

    @width, @height = options[:width], options[:height]

    if @@full_screen || options[:full_screen]
      @@full_screen = true
      args << "--present"
    end
    @render_mode  ||= JAVA2D
    x = options[:x] || 0
    y = options[:y] || 0
    args << "--location=#{x}, #{y}"

    title = options[:title] || File.basename(SKETCH_PATH).sub(/(\.rb)$/, '').titleize
    args << title
  end
end

sketch_path = File.expand_path('fixtures/test_sketch.rb', File.dirname(__FILE__))
require sketch_path

Processing::App.const_set(:SKETCH_PATH, sketch_path)

require 'dxruby'
require 'dxruby_rp5'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dxruby_rp5-0.0.4 spec/spec_helper.rb