Puoi ruotare i due rettangoli tramite la tastiera e/o il mouse
- Premi il tasto INVIO e farai ruotare il rettangolo rosso
- Premi il tasto SPAZIO, la barra spaziatrice, e farai ruotare il rettangolo blu
- Premi i tasti INVIO e SPAZIO per ruotarli entrambi
- Posiziona il puntatore del mouse su uno dei due rettangoli e con il clic di uno dei tasti lo farai ruotare
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
ww=200 hh=100 distanza=25 ww2=ww/2 hh2=hh/2 x1=GraphicsWindow.Width/2-ww-distanza y1=GraphicsWindow.Height/2-hh2-distanza x2=x1+ww y2=y1+hh x3=GraphicsWindow.Width/2+distanza y3=GraphicsWindow.Height/2-hh2-distanza x4=GraphicsWindow.Width/2+ww y4=GraphicsWindow.Height/2+hh2 GraphicsWindow.BrushColor="Red" forma1=Shapes.AddRectangle(ww, hh) Shapes.Move(forma1,x1,y1) GraphicsWindow.BrushColor="Blue" forma2=Shapes.AddRectangle(ww, hh) Shapes.Move(forma2,x3,y3) GraphicsWindow.KeyDown =tastoGiu GraphicsWindow.KeyUp =tastoSu GraphicsWindow.MouseDown=mouseGiu GraphicsWindow.MouseUp =mouseSu Sub tastoGiu If(GraphicsWindow.LastKey = "Return") then Shapes.Rotate(forma1, 90) ElseIf(GraphicsWindow.LastKey = "Space") Then Shapes.Rotate(forma2, 90) EndIf EndSub Sub tastoSu If(GraphicsWindow.LastKey = "Return") then Shapes.Rotate(forma1, 0) ElseIf(GraphicsWindow.LastKey = "Space") Then Shapes.Rotate(forma2, 0) EndIf EndSub Sub mouseGiu x=GraphicsWindow.MouseX y=GraphicsWindow.MouseY If(x >= x1) And (x <= x2) And (y >= y1) And (y <= y2) Then Shapes.Rotate(forma1, 90) ElseIf(x >= x3) And (x <= x4) And (y >= y3) And (y <= y4) Then Shapes.Rotate(forma2, 90) EndIf EndSub Sub mouseSu x=GraphicsWindow.MouseX y=GraphicsWindow.MouseY If(x >= x1) And (x <= x2) And (y >= y1) And (y <= y2) Then Shapes.Rotate(forma1, 0) ElseIf(x >= x3) And (x <= x4) And (y >= y3) And (y <= y4) Then Shapes.Rotate(forma2, 0) EndIf EndSub |