Desktop Clock. by Darkfoil9th Jun 2006 20:24
|
---|
Summary An anaolgue clock for your desktop. Description An analogue clock that runs in the background and can be positioned anywhere on the screen using the mouse. To compile this program you will need to have the SkinWin .dll this can be obtained free from www.ACCODE.com Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Rem Project: Clock Rem Created: 09/06/2006 11:11:07 Rem ***** Main Source File ***** set window on set window size 190,155 set window layout 0,0,0 skin window "skin2.bmp" color backdrop rgb(0,0,0) autocam off set ambient light 100 sync on sync rate 0 CLOCKFACE() HOURHAND() MINUTEHAND() SECONDHAND() GETTIME() do UPDATETIME() if mouseclick()=1 then window move if mouseclick()=2 then end sync loop function CLOCKFACE() make object box 1,400,400,1 load image "clock face.png",1 texture object 1,1 point object 1,camera position x(),camera position y(),camera position z() position camera 0,0,-350 endfunction function HOURHAND() make object sphere 2,300 set image colorkey 0,0,0 load image "hour hand2.bmp",2,0 set object transparency 2,1 texture object 2,2 position object 2,object position x(1),object position y(1),object position z(1) endfunction function MINUTEHAND() make object sphere 3,300 set image colorkey 0,0,0 load image "minute hand2.bmp",3,0 set object transparency 3,1 texture object 3,3 position object 3,object position x(1),object position y(1),object position z(1) endfunction function SECONDHAND() make object sphere 4,310 set image colorkey 0,0,0 load image "second hand.bmp",4,0 set object transparency 4,1 texture object 4,4 position object 4,object position x(1),object position y(1),object position z(1) endfunction function GETTIME() t$=get time$() hours$=left$(t$,2) hours=val(hours$) if hours>12 hours=hours-12 hours$=str$(hours) endif minutes$=mid$(t$,4)+mid$(t$,5) seconds$=right$(t$,2) zrotate object 2,-wrapvalue(val(hours$)*30) zrotate object 3,-wrapvalue(val(minutes$)*6) zrotate object 4,-wrapvalue(val(seconds$)*6) endfunction function UPDATETIME() t$=get time$() hours$=left$(t$,2) hours=val(hours$) if hours>12 hours=hours-12 hours$=str$(hours) endif minutes$=mid$(t$,4)+mid$(t$,5) seconds$=right$(t$,2) zrotate object 2,-wrapvalue(val(hours$)*30)+(-wrapvalue(val(minutes$)*6)/15) zrotate object 3,-wrapvalue(val(minutes$)*6)+(-wrapvalue(val(seconds$)*6)/60) zrotate object 4,-wrapvalue(val(seconds$)*6) endfunction |