Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | Rem Project: Dark Basic Pro Project |
2 | Rem Created: Sunday, August 23, 2015 |
||
3 | |||
4 | Rem ***** Main Source File ***** |
||
5 | |||
6 | // Konfiguration |
||
7 | #constant framerate 30 |
||
8 | |||
9 | sync on |
||
10 | sync rate framerate |
||
11 | |||
12 | set text font "arial" : set text size 30 : set text transparent |
||
13 | |||
14 | |||
15 | open to read 1, "config.txt" |
||
16 | clockSpeedFactor = fileReadInt(1) |
||
17 | clockBlinksPerSecond = fileReadInt(1) |
||
18 | clockShowSeconds = fileReadInt(1) |
||
19 | close file 1 |
||
20 | |||
21 | |||
22 | |||
23 | // Session variables |
||
24 | clockTickCounter=0 |
||
25 | clockCurrentMidDot=0 |
||
26 | clockSecs=0 |
||
27 | |||
28 | do |
||
29 | ticksPerSecond = framerate |
||
30 | |||
31 | if mod(clockTickCounter*clockBlinksPerSecond,ticksPerSecond) = 0 |
||
32 | clockCurrentMidDot = 1 - clockCurrentMidDot |
||
33 | gosub printClock |
||
34 | endif |
||
35 | |||
36 | if mod(clockTickCounter*clockSpeedFactor,ticksPerSecond) = 0 |
||
37 | gosub printClock |
||
38 | clockSecs = clockSecs + 1 |
||
39 | endif |
||
40 | |||
41 | clockTickCounter = clockTickCounter + 1 |
||
42 | |||
43 | sync |
||
44 | LOOP |
||
45 | |||
46 | printclock: |
||
47 | cls |
||
48 | if clockCurrentMidDot = 0 |
||
49 | middle$ = " " |
||
50 | else |
||
51 | middle$ = ":" |
||
52 | endif |
||
53 | min = clockSecs/60 |
||
54 | hours = min/60 |
||
55 | if clockShowSeconds |
||
56 | secsText$ = middle$+TwoDigit$(mod(clockSecs,60)) |
||
57 | else |
||
58 | secsText$ = "" |
||
59 | endif |
||
60 | print TwoDigit$(mod(hours,24)), middle$, TwoDigit$(mod(min,60)), secsText$ |
||
61 | return |
||
62 | |||
63 | function TwoDigit$(value) |
||
64 | if value < 10 |
||
65 | ret$ = "0"+STR$(value) |
||
66 | else |
||
67 | ret$ = STR$(value) |
||
68 | ENDIF |
||
69 | ENDFUNCTION ret$ |
||
70 | |||
71 | function mod(num,modulus) |
||
72 | value=num-((num/modulus)*modulus) |
||
73 | endfunction value |
||
74 | |||
75 | function fileReadInt(fileNum) |
||
76 | read string 1, s$ |
||
77 | ret=val(s$) |
||
78 | ENDFUNCTION ret |