Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pi = 3.1415
- -- stundenzeiger, 3 punkte und rotation.
- szp1x = nil
- szp2y = nil
- szp2x = nil
- szp2y = nil
- szp3x = nil
- szp3y = nil
- szrot = nil
- -- minutenzeiger, 3 punkte und rotation.
- mzp1x = nil
- mzp1y = nil
- mzp2x = nil
- mzp2y = nil
- mzp3x = nil
- mzp3y = nil
- mzrot = nil
- -- groessen umrechnungsfaktor x,y
- svx = nil
- svy = nil
- -- setup screen
- monitor = peripheral.wrap("right")
- term.redirect(monitor)
- monitor.setBackgroundColor(1)
- monitor.setTextColor(1)
- monitor.setTextScale(0.5)
- term.clear()
- -- berechne umrechnungs faktoren
- sx,sy = term.getSize()
- svx = sx/101
- svy = sy/101
- --print(svx," ",svy)
- -- get Time
- while true do
- t = os.time()
- -- zeichne zifferblatt
- monitor.setBackgroundColor(1)
- monitor.clear()
- paintutils.drawBox((48.5*svx),(1.5*svy),(54.5*svx),(15.5*svy),32768)
- paintutils.drawBox((1.5*svx),(48.5*svy),(15.5*svx),(54.5*svy),32768)
- paintutils.drawBox((48.5*svx),(86.5*svy),(54.5*svx),(101.5*svy),32768)
- paintutils.drawBox((86.5*svx),(48.5*svy),(101.5*svx),(54.5*svy),32768)
- --stunde in rad
- s = (2*pi)/12
- p = 0
- l = 51.5
- for i = 1,12 do
- p = p + s
- if i == 3 or i == 6 or i == 9 or i == 12 then
- else
- p1x = svx*(51.5+math.sin(p)*l)
- p1y = svy*(51.5+math.cos(p)*l)
- p2x = svx*(51.5+math.sin(p)*(l-13))
- p2y = svy*(51.5+math.cos(p)*(l-13))
- --print(p1x," ",p1y," ",p2x," ",p2y)
- paintutils.drawLine(p1x,p1y,p2x,p2y,32768)
- end
- end
- -- zeichne zeiger
- szrot = (2*pi*t)/12
- mzrot = 2*pi*t
- szl = 37
- mzl = 45
- szp1x = svx*(51.5+math.sin(szrot)*szl)
- szp1y = svy*(51.5-math.cos(szrot)*szl)
- szp2x = svx*(51.5+math.sin(szrot+0.14)*szl*0.8)
- szp2y = svy*(51.5-math.cos(szrot+0.14)*szl*0.8)
- szp3x = svx*(51.5+math.sin(szrot-0.14)*szl*0.8)
- szp3y = svy*(51.5-math.cos(szrot-0.14)*szl*0.8)
- mx = 51.5*svx
- my = 51.5*svy
- paintutils.drawLine(mx,my,szp2x,szp2y,32768)
- paintutils.drawLine(szp2x,szp2y,szp1x,szp1y,32768)
- paintutils.drawLine(szp1x,szp1y,szp3x,szp3y,32768)
- paintutils.drawLine(szp3x,szp3y,mx,my,32768)
- mzp1x = svx*(51.5+math.sin(mzrot)*mzl)
- mzp1y = svy*(51.5-math.cos(mzrot)*mzl)
- mzp2x = svx*(51.5+math.sin(mzrot+0.1)*mzl*0.7)
- mzp2y = svy*(51.5-math.cos(mzrot+0.1)*mzl*0.7)
- mzp3x = svx*(51.5+math.sin(mzrot-0.1)*mzl*0.7)
- mzp3y = svy*(51.5-math.cos(mzrot-0.1)*mzl*0.7)
- paintutils.drawLine(mx,my,mzp2x,mzp2y,32768)
- paintutils.drawLine(mzp2x,mzp2y,mzp1x,mzp1y,32768)
- paintutils.drawLine(mzp1x,mzp1y,mzp3x,mzp3y,32768)
- paintutils.drawLine(mzp3x,mzp3y,mx,my,32768)
- sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement