ruby-processingでProcessing->Examples->Basic->Webの写経
写経してみたw;
case :EmbeddedLinks when :LoadingImages def setup size 200,200 img = load_image "http://www.processing.org/img/processing_beta_cover.gif" image img,0,45 end def draw end when :EmbeddedLinks def setup size 200,200 @button = nil end def draw background 204 @button == :over_left_button ? fill(255) : no_fill rect 20,60,75,75 rect 50,90,15,15 @button == :over_right_button ? fill(255) : no_fill rect 105,60,75,75 line 135,105,155,85 line 140,85,155,85 line 155,85,155,100 end def mouse_pressed case @button when :over_left_button link "http://www.processing.org" when :over_right_button link "http://www.processing.org", "_new" end end def mouse_moved check_buttons end def mouse_dragged check_buttons end def check_buttons case when ((20 < mouse_x) and (mouse_x < 95) and (60 < mouse_y) and (mouse_y <135)) @button = :over_left_button when ((105 < mouse_x) and (mouse_x < 180) and (60 < mouse_y) and (mouse_y <135)) @button = :over_right_button else @button = nil end end end