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 | print "hallo" |
||
16 | sync |
||
17 | |||
18 | rem Level einlesen |
||
19 | open to read 1, "config.txt" |
||
20 | clockSpeedFactor = fileReadInt(1) |
||
21 | clockBlinksPerSecond = fileReadInt(1) |
||
22 | clockShowSeconds = fileReadInt(1) |
||
23 | close file 1 |
||
24 | |||
25 | |||
26 | |||
27 | // Session variables |
||
28 | clockTickCounter=0 |
||
29 | clockCurrentMidDot=0 |
||
30 | clockSecs=0 |
||
31 | |||
32 | do |
||
33 | ticksPerSecond = framerate |
||
34 | |||
35 | if mod(clockTickCounter*clockBlinksPerSecond,ticksPerSecond) = 0 |
||
36 | clockCurrentMidDot = 1 - clockCurrentMidDot |
||
37 | gosub printClock |
||
38 | endif |
||
39 | |||
40 | if mod(clockTickCounter*clockSpeedFactor,ticksPerSecond) = 0 |
||
41 | gosub printClock |
||
42 | clockSecs = clockSecs + 1 |
||
43 | endif |
||
44 | |||
45 | clockTickCounter = clockTickCounter + 1 |
||
46 | |||
47 | sync |
||
48 | LOOP |
||
49 | |||
50 | printclock: |
||
51 | cls |
||
52 | if clockCurrentMidDot = 0 |
||
53 | middle$ = " " |
||
54 | else |
||
55 | middle$ = ":" |
||
56 | endif |
||
57 | min = clockSecs/60 |
||
58 | hours = min/60 |
||
59 | if clockShowSeconds |
||
60 | secsText$ = middle$+TwoDigit$(mod(clockSecs,60)) |
||
61 | else |
||
62 | secsText$ = "" |
||
63 | endif |
||
64 | print TwoDigit$(mod(hours,24)), middle$, TwoDigit$(mod(min,60)), secsText$ |
||
65 | return |
||
66 | |||
67 | function TwoDigit$(value) |
||
68 | if value < 10 |
||
69 | ret$ = "0"+STR$(value) |
||
70 | else |
||
71 | ret$ = STR$(value) |
||
72 | ENDIF |
||
73 | ENDFUNCTION ret$ |
||
74 | |||
75 | function mod(num,modulus) |
||
76 | value=num-((num/modulus)*modulus) |
||
77 | endfunction value |
||
78 | |||
79 | function fileReadInt(fileNum) |
||
80 | read string 1, s$ |
||
81 | ret=val(s$) |
||
82 | ENDFUNCTION ret |