Draw a clock: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: IupCloseOnEscape no longer needed) |
(added MiniScript example) |
||
Line 3,533: | Line 3,533: | ||
pause(1); |
pause(1); |
||
end;</lang> |
end;</lang> |
||
=={{header|MiniScript}} |
|||
This solution works with [https://miniscript.org/MiniMicro Mini Micro], and uses its default SpriteDisplay. |
|||
<lang MiniScript>// draw a clock hand, then copy it to an image |
|||
gfx.clear color.clear |
|||
gfx.fillPoly [[60,5], [64,10], [128,5], [64,0]], color.yellow |
|||
handImg = gfx.getImage(0,0, 128,10) |
|||
clear // clear all displays |
|||
// prepare the face sprite |
|||
faceImg = file.loadImage("/sys/pics/shapes/CircleThinInv.png") |
|||
face = new Sprite |
|||
face.image = faceImg |
|||
face.scale = 2 |
|||
face.x = 480; face.y = 320 |
|||
display(4).sprites.push face |
|||
// prepare the hand sprite (from previously created image) |
|||
hand = new Sprite |
|||
hand.image = new Sprite |
|||
hand.image = handImg |
|||
hand.x = face.x; hand.y = face.y |
|||
display(4).sprites.push hand |
|||
// main loop |
|||
while true |
|||
hand.rotation = 90 - floor(time) % 60 * 6 |
|||
wait |
|||
end while</lang> |
|||
=={{header|NetRexx}}== |
=={{header|NetRexx}}== |