Code : Tout sélectionner
; SPH(2021)
; PB573
InitSprite()
InitMouse()
InitKeyboard()
;SetPriorityClass_ ( GetCurrentProcess_ (), #IDLE_PRIORITY_CLASS )
If ExamineDesktops()
dw.w=DesktopWidth(0)
dh.w=DesktopHeight(0)
do.b=DesktopDepth(0)
Else
dw.w=1024
dh.w=768
EndIf
OpenScreen(dw,dh,do,"Les horloges de SPH")
xx=dw/2
yy=dh/2
pis.f=ATan(1)*12.1585
pim.f=ATan(1)*12.1585
pih.f=ATan(1)*2.4317
echp=yy/1.4
;echh=yy/2.4
echm=yy/1.5
col=RGB(33,33,33)
ii.f=Random(20)/100
uu.f=Random(20)/100
ii2.f=Random(20)/100
uu2.f=Random(20)/100
;;;;;;;;;;;
;;;;;;;;;;;
;;;;;;;;;;;
Repeat ; Boucle principale
xxx=Cos(ii)*45+Sin(ii2)*40
yyy=Sin(uu)*45-Cos(uu2)*40
decx.f=Cos(ii)/18+Sin(uu2)/15
ExamineMouse()
xmouse=MouseDeltaX()/45 ; /x : x= sensibilité
ymouse=MouseDeltaY()/45 ; /x : x= sensibilité
If MouseButton(#PB_MouseButton_Left)<>0
s+1:If s>=60:s-60:m+1:EndIf:If m=60:m=0:h+1:EndIf:If h=12:h=0:EndIf
Else
h=Hour(Date()):m=Minute(Date()):s=Second(Date())
EndIf
;*****
ClearScreen(0)
StartDrawing(ScreenOutput())
;;;;;;;;;;;
ss.f=decx+s/pis
mm.f=decx+(m+s/60)/pim
hh.f=decx+(h+m/60)/pih
For i=0 To 11
If i=0 Or i=3 Or i=6 Or i=9
co=RGB(255,255,255)
Else
co=RGB(170,180,190)
EndIf
For u=1 To 5
Plot(xx+Sin(decx+i/pih)*(echp+xxx)+Random(6)-3,yy-Cos(decx+i/pih)*(echp+yyy)+Random(6)-3,co)
Next
Next
x1=Sin(mm)*(echm+xxx)
y1=-Cos(mm)*(echm+yyy)
;Line(xx,yy,x1,y1,RGB(200,200,0))
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx
yy2.f=yy
u=0
For i=0 To dist/3
r=255;Random(255)
Plot(xx2-u/32+Random(u/16),yy2-u/32+Random(u/16),RGB(r,r,0))
xx2+xx1
yy2+yy1
u+2
Next
For i=0 To dist/2
u-1
r=255;Random(255)
Plot(xx2-u/32+Random(u/16),yy2-u/32+Random(u/16),RGB(r,r,0))
xx2+xx1
yy2+yy1
Next
x1=Sin(hh)*(echm+xxx)
y1=-Cos(hh)*(echm+yyy)
;Line(xx,yy,x1,y1,RGB(200,0,0))
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx
yy2.f=yy
u=0
For i=0 To dist/8
r=255;Random(255)
Plot(xx2-u/8+Random(u/4),yy2-u/8+Random(u/4),RGB(r,20,r/3))
xx2+xx1
yy2+yy1
u+2
Next
For i=0 To dist/4
u-1
r=255;Random(255)
Plot(xx2-u/8+Random(u/4),yy2-u/8+Random(u/4),RGB(r,20,r/3))
xx2+xx1
yy2+yy1
Next
x1=Sin(ss)*(echm+xxx)
y1=-Cos(ss)*(echm+yyy)
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx-2
yy2.f=yy-2
For i=0 To dist
If Random(2)=1
Plot(xx2+Random(4),yy2+Random(4),RGB(0,0,255));Random(255)))
EndIf
xx2+xx1
yy2+yy1
Next
;ii+0.024
;uu+0.0189
;ii2+0.013
;uu2+0.021
ii+0.007
uu+0.0059
ii2+0.0043
uu2+0.0031
;;;;;;;;;;;
StopDrawing()
;*****
FlipBuffers()
Delay(1)
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_All)
End