0,0 → 1,78 |
Rem Project: Dark Basic Pro Project |
Rem Created: Sunday, August 23, 2015 |
|
Rem ***** Main Source File ***** |
|
// Konfiguration |
#constant framerate 30 |
|
sync on |
sync rate framerate |
|
set text font "arial" : set text size 30 : set text transparent |
|
|
open to read 1, "config.txt" |
clockSpeedFactor = fileReadInt(1) |
clockBlinksPerSecond = fileReadInt(1) |
clockShowSeconds = fileReadInt(1) |
close file 1 |
|
|
|
// Session variables |
clockTickCounter=0 |
clockCurrentMidDot=0 |
clockSecs=0 |
|
do |
ticksPerSecond = framerate |
|
if mod(clockTickCounter*clockBlinksPerSecond,ticksPerSecond) = 0 |
clockCurrentMidDot = 1 - clockCurrentMidDot |
gosub printClock |
endif |
|
if mod(clockTickCounter*clockSpeedFactor,ticksPerSecond) = 0 |
gosub printClock |
clockSecs = clockSecs + 1 |
endif |
|
clockTickCounter = clockTickCounter + 1 |
|
sync |
LOOP |
|
printclock: |
cls |
if clockCurrentMidDot = 0 |
middle$ = " " |
else |
middle$ = ":" |
endif |
min = clockSecs/60 |
hours = min/60 |
if clockShowSeconds |
secsText$ = middle$+TwoDigit$(mod(clockSecs,60)) |
else |
secsText$ = "" |
endif |
print TwoDigit$(mod(hours,24)), middle$, TwoDigit$(mod(min,60)), secsText$ |
return |
|
function TwoDigit$(value) |
if value < 10 |
ret$ = "0"+STR$(value) |
else |
ret$ = STR$(value) |
ENDIF |
ENDFUNCTION ret$ |
|
function mod(num,modulus) |
value=num-((num/modulus)*modulus) |
endfunction value |
|
function fileReadInt(fileNum) |
read string 1, s$ |
ret=val(s$) |
ENDFUNCTION ret |