File: blockyclocky.kbs

package info (click to toggle)
basic256 2.0.99.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,888 kB
  • sloc: cpp: 17,185; yacc: 4,025; lex: 1,466; java: 1,091; sh: 39; xml: 33; makefile: 20
file content (49 lines) | stat: -rw-r--r-- 927 bytes parent folder | download
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
# blockyclocky.kbs - using printat
# j.m.reneau 2021-07-13

global h,w,cx,cy

w = 35
h = 20

cx = w/2
cy = h/2


subroutine draw(a, pct, char)
	# draw a hand at angle for percent of radius
	for r = 0 to pct step .1
		x = cx + r * cx * cos(a-pi/2)
		y = cy + r * cy * sin(a-pi/2)
		printat x,y,char
	next r
end subroutine

oldhour = 0
oldminute = 0
oldsecond = 0

for a = 0 to 2 * pi step .05
	x = cx + cx * cos(a)
	y = cy + cy * sin(a)
	printat x,y,"#"
next a

while true
	newhour = (hour+minute/60)/12*2*pi
	newminute = minute/60*2*pi
	newsecond = second/60*2*pi

	if oldhour <> newhour then call draw(oldhour, .55, " ")
	if oldminute <> newminute then call draw(oldminute, .70, " ")
	if oldsecond <> newsecond then call draw(oldsecond, .85, " ")

	call draw(newhour, .55, "*")
	call draw(newminute, .70, "%")
	call draw(newsecond, .85, ".")

	oldhour = newhour
	oldminute = newminute
	oldsecond = newsecond
	pause 1
end while