REM Project: Clock
REM Created: 30/10/2005 23:24:32
REM
REM ***** Main Source File *****
REM
 
sync on : sync rate 0
 
time$ = get time$()
h$ = mid$(time$,1) + mid$(time$,2)
hB$ = retBinary$(h$)
m$ = mid$(time$,4) + mid$(time$,5)
mB$ = retBinary$(m$)
s$ = mid$(time$,7) + mid$(time$,8)
sB$ = retBinary$(s$)
 
for a=1 to 18
   make object sphere a,1
   color object a,0
next a
 
position camera 3.5,1,-5
 
sync
do
 
   time$ = get time$()
 
   h$ = mid$(time$,1) + mid$(time$,2)
   hB$ = retBinary$(h$)
   m$ = mid$(time$,4) + mid$(time$,5)
   mB$ = retBinary$(m$)
   s$ = mid$(time$,7) + mid$(time$,8)
   sB$ = retBinary$(s$)
 
   renderBinary(0,0,2,hB$)
   renderBinary(6,0,1,mB$)
   renderBinary(12,0,0,sB$)
 
   control camera using arrowkeys 0,0.25,0.25
 
   sync
loop
end
 
function renderBinary(numOff as integer,xOff as integer, yOff as integer, pString$ as string)
 
   for a=1 to 6
      if mid$(pString$,a) = "1"
         color object numOff+a,rgb(250,250,250)
         position object numOff+a,xOff+a,yOff,0
      else
         if object exist(numOff+a)=1 then color object numOff+a,0
         position object numOff+a,xOff+a,yOff,0
      endif
   next a
 
endfunction
 
function retBinary$(pString$ as string)
 
   retBin$ as string
   temp as string
 
   temp = bin$(val(pString$))
   for a=26 to 32
      retBin$ = retBin$ + mid$(temp,a)
   next a
 
endfunction retBin$