# alias_background.rb # class Java::ProcessingCore::PApplet java_alias :int_background, :background, [Java::int] java_alias :image_background, :background, [Java::ProcessingCore::PImage] end attr_reader :img, :show, :col_int, :back_image def setup size(640, 360) @show = false @img = loadImage("test.png") # NB: test.png size should equal frame size #@back_image = img.to_java(Java::ProcessingCore::PImage) end def draw int_background(0) # background(0) # warns about ambigious method # background(img) if show image_background(img) if show # does not warn about ambiguous method # int_background(0) if show # uses a precast java object end def mouse_pressed @show = !show end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Wednesday, 22 May 2013
Precast to a java object or use an alias method in ruby-processing (for overloaded java methods)
Labels:
alias_java,
to_java
Subscribe to:
Post Comments (Atom)
Followers
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment