Skip to content

Instantly share code, notes, and snippets.

@dragodragonitis
Last active December 19, 2015 10:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragodragonitis/5939849 to your computer and use it in GitHub Desktop.
Save dragodragonitis/5939849 to your computer and use it in GitHub Desktop.
rechte maustaste große kreise bzw sterne. linke maustaste kleine keise bzw sterne. mit der mittleren maustaste kann man linien malen. "c" = clear. "q" = quit. k=umschalten auf keise. "s"= umschalten auf sterne "w"= text eingeben, "h" = hilfe. "a"=leine linien explosion zirkularer natur."l"= linie von mauspoitsion beim ersten klick zur mauspositi…
Shoes.app :width => 1000, :height => 800 do
background black
@colors = [red,blue,green,white,yellow,violet]
@modus = "oval"
animate do
button, @left,@top = mouse
if button == 2
@colorrand = @colors.sample
stroke @colorrand
fill @colorrand
if @modus == "star"
size = 3 + rand(8)
else
size = rand(300)
end
send @modus, @left,@top,size, :center =>true
end
if button == 1
if @modus == "radierer"
stroke black
fill black
oval @left, @top, @radier, :center => true
else
if @modus == "farbe"
stroke send(@farbekreis)
fill send(@farbekreis)
oval @left, @top, rand(50), :center => true
else
@colorrand = @colors.sample
stroke @colorrand
fill @colorrand
send @modus, @left,@top,rand(50), :center => true
end
end
end
if button == 3
stroke @colors.sample
line 500,400,@left,@top
end
end
keypress do |key|
if key == "c"
clear
background black
end
if key =="h"
alert "rechte maustaste grosse kreise bzw sterne. linke maustaste kleine keise bzw sterne. mit der mittleren maustaste kann man linien malen. 'c' = clear. 'q'= quit. k=umschalten auf keise. 's'= umschalten auf sterne 'w'=text eingeben, 'a'=Linienexplosion zirkularer Natur verursachen 'l'= linie von mauspoitsion beim ersten klick zur mausposition vom zweiten click.'r'= radierer.'f'=aussuchbare farbe."
end
if key == "w"
lol=ask "was hast du zu sagen?"
window do
caption lol
keypress do |zu|
if zu == "q"
close
end
end
end
end
if key == "q"
close
end
if key == "s"
@modus = "star"
end
if key =="k"
@modus = "oval"
end
if key == "a"
10.times do |i|
colorrand = @colors.sample
stroke colorrand
fill colorrand
line @left, @top,rand(1000), rand(800)
end
end
if key == "l"
if @vonx == nil
@vonx = @left
@vony = @top
else
fill @colors.sample
stroke @colors.sample
line @vonx, @vony, @left, @top
@vonx, @vony = nil, nil
end
end
if key == "r" and @modus != "radierer"
@radier = ask "wie gross?"
@radier = @radier.to_i
@modus = "radierer"
break
end
if key == "r" and @modus == "radierer"
@modus = "oval"
end
if key == "f" and @modus != "farbe"
@farbekreis = ask "welche farbe (bitte auf englisch)"
@modus = "farbe"
break
end
if key == "f" and @modus == "farbe"
@modus = "oval"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment