Skip to content

Instantly share code, notes, and snippets.

@veered
Created February 25, 2013 18:41
Show Gist options
  • Save veered/5032155 to your computer and use it in GitHub Desktop.
Save veered/5032155 to your computer and use it in GitHub Desktop.
Shoes.setup do
gem 'curb >= 0.8.3'
gem 'json >= 1.1.1'
end
require 'visual_objects'
Shoes.app do
background "#FFFFFF"
@stroke = []
@strokes = []
@lines = [];
motion do |left, top|
button = mouse[0]
if (button == 1)
unless @stroke.empty?
@lines << line(@stroke.last[:x], @stroke.last[:y], left, top)
end
@stroke << {:x => left, :y => top}
end
end
release do |button, left, top|
if (button == 1)
@strokes << @stroke
@stroke = []
end
end
button("clear").click {
@lines.each(&:remove)
@strokes = @stroke = []
}
button("submit").click {
alert('/int_0^1')
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment