Basic Shoes app

Hey there everyone !

I am looking for a basic Shoes app example to create rectangles with the
mouse and possibly moving them.

Maybe someone has something like this already ?

Thanks
JCLL

You may find this article and its example enlightening:
http://teachingkids.railsbridge.org/2009/08/15/teaching-ruby-to-high-school-girls.html

It's not exactly what you want, but it's close enough to get you going.

Hi JCLL,

Interesting! How about this one? :wink:

Shoes.app do
  animate do
    b, l, t = mouse
    if b == 2 and !@start
      r = rect l, t, 1, 1
      @r = r
      @flag = false
      r.click{@flag = true; @r = r}
      r.release{@flag = false}
      motion{|left, top| @r.move(left, top) if @flag}
      @start, @l, @t = true, l + 1, t + 1
    elsif b == 2 and @start
      @r.width, @r.height = l - @l, t - @t
    else
      @start = false
    end
  end
end

You can create rectangles with right button and also can move them with left
button.

Cheers,
ashbb