Page 1 sur 1

Heure locale avec des sprites

Publié : dim. 30/oct./2022 9:24
par Micoute
Bonjour à tous,

comme j'aime bien programmer je me suis fait une horloge numérique aves des digits, j'éspère qu'elle vous plaira.
https://www.dropbox.com/s/d7ws0jwz1yl4t ... s.zip?dl=1

Re: Heure locale avec des sprites

Publié : mar. 01/nov./2022 18:38
par TazNormand
Salut Micoute

Avec les include ce serait mieux :lol:

Re: Heure locale avec des sprites

Publié : mer. 02/nov./2022 11:06
par SPH
Moi, je me suis fait une horloge avec des pixels :

Code : Tout sélectionner

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Les horloges de SPH  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Code : SPH(2022) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;é

InitSprite() 
InitMouse() 
InitKeyboard() 

;SetPriorityClass_ ( GetCurrentProcess_ (), #IDLE_PRIORITY_CLASS ) 

ExamineDesktops()
dw.w=DesktopWidth(0) 
dh.w=DesktopHeight(0)
do.b=DesktopDepth(0)

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

;;;;;;;;;;;
sphii.f=0
sphuu.f=0
sphii2.f=0
sphuu2.f=0
sphiii.f=Random(1000)/100000
sphuuu.f=Random(1000)/100000
sphiii2.f=Random(1000)/100000
sphuuu2.f=Random(1000)/100000
rayonx=dw/5
rayony=dh/6
ShowCursor_(0)
;;;;;;;;;;;
;;;;;;;;;;;

MouseLocate(xx,yy)

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()
x2mouse=MouseX()
y2mouse=MouseY()

xmouse=Cos(sphii)*rayonx+Sin(sphii2)*rayonx
ymouse=Sin(sphuu)*rayony+Cos(sphuu2)*rayony

xx2021=xmouse+x2mouse
yy2021=ymouse+y2mouse



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

If MouseButton(#PB_MouseButton_Right)<>0
sphiii.f=Random(1000)/100000
sphuuu.f=Random(1000)/100000
sphiii2.f=Random(1000)/100000
sphuuu2.f=Random(1000)/100000
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
For u=1 To 5
If i=0 Or i=3 Or i=6 Or i=9
co=RGB(255,255,255)
Else
co=RGB(80,80,80)
EndIf

  sphx=xx2021+Sin(decx+i/pih)*(echp+xxx)+Random(6)-3 ;;;;;;;;;;;;xx
  sphy=yy2021-Cos(decx+i/pih)*(echp+yyy)+Random(6)-3 ;;;;;;;;;;;;yy
  
  If sphx<0
    co=RGB(00,80,00)
  sphx=(sphx*-1)/2
  EndIf
  If sphx>=dw
    co=RGB(00,80,00)
    sphx=dw-1-Abs(dw-sphx)/2
  EndIf
  
  If sphy<0
    co=RGB(00,80,00)
  sphy=(sphy*-1)/2
  EndIf
  If sphy>=dh
    co=RGB(00,80,00)
  sphy=dh-1-Abs(dh-sphy)/2
  EndIf
  
  Plot(sphx,sphy,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=xx2021;;;;;;;xx
yy2.f=yy2021;;;;;;;yy
u=0
;r=255;Random(255)
For i=0 To dist/3
  co=RGB(255,255,00)
  sphx=xx2-u/32+Random(u/16)
  sphy=yy2-u/32+Random(u/16)
  If sphx<0
    co=RGB(00,80,00)
  sphx=(sphx*-1)/2
  EndIf
  If sphx>=dw
    co=RGB(00,80,00)
    sphx=dw-1-Abs(dw-sphx)/2
  EndIf
  
  If sphy<0
    co=RGB(00,80,00)
  sphy=(sphy*-1)/2
  EndIf
  If sphy>=dh
    co=RGB(00,80,00)
    sphy=dh-1-Abs(dh-sphy)/2
  EndIf
  
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
u+2
Next
;r=255;Random(255)
For i=0 To dist/2
  co=RGB(255,255,00)
  u-1
  sphx=xx2-u/32+Random(u/16)
  sphy=yy2-u/32+Random(u/16)
  If sphx<0
    co=RGB(00,80,00)
  sphx=(sphx*-1)/2
  EndIf
  If sphx>=dw
    co=RGB(00,80,00)
    sphx=dw-1-Abs(dw-sphx)/2
  EndIf
  
  If sphy<0
    co=RGB(00,80,00)
  sphy=(sphy*-1)/2
  EndIf
  If sphy>=dh
    co=RGB(00,80,00)
    sphy=dh-1-Abs(dh-sphy)/2
  EndIf
  
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
Next


x1=Sin(hh)*(echm+xxx)
y1=-Cos(hh)*(echm+yyy)
dist=Sqr(x1*x1+y1*y1)
xx1.f=x1/dist
yy1.f=y1/dist
xx2.f=xx2021;;;;;;;xx
yy2.f=yy2021;;;;;;;yy
u=0
;r=255;Random(255)
For i=0 To dist/8
  co=RGB(255,20,86)
  sphx=xx2-u/8+Random(u/4)
  sphy=yy2-u/8+Random(u/4)
  If sphx<0
    co=RGB(00,80,00)
  sphx=(sphx*-1)/2
  EndIf
  If sphx>=dw
    co=RGB(00,80,00)
    sphx=dw-1-Abs(dw-sphx)/2
  EndIf
  
  If sphy<0
    co=RGB(00,80,00)
  sphy=(sphy*-1)/2
  EndIf
  If sphy>=dh
    co=RGB(00,80,00)
    sphy=dh-1-Abs(dh-sphy)/2
  EndIf
  
Plot(sphx,sphy,co)
xx2+xx1
yy2+yy1
u+2
Next
r=255;Random(255)
For i=0 To dist/4
  u-1
    co=RGB(255,20,86)
    sphx=xx2-u/8+Random(u/4)
  sphy=yy2-u/8+Random(u/4)
  If sphx<0
    co=RGB(00,80,00)
  sphx=(sphx*-1)/2
  EndIf
  If sphx>=dw
    co=RGB(00,80,00)
    sphx=dw-1-Abs(dw-sphx)/2
  EndIf
  
  If sphy<0
    co=RGB(00,80,00)
  sphy=(sphy*-1)/2
  EndIf
  If sphy>=dh
    co=RGB(00,80,00)
    sphy=dh-1-Abs(dh-sphy)/2
  EndIf
  
Plot(sphx,sphy,co)
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=xx2021-2;;;;;;;xx-2
yy2.f=yy2021-2;;;;;;;yy-2
For i=0 To dist
  If Random(2)=1
    co=RGB(86,20,255)
    sphx=xx2+Random(4)
  sphy=yy2+Random(4)
  If sphx<0
    co=RGB(00,80,00)
  sphx=(sphx*-1)/2
  EndIf
  If sphx>=dw
    co=RGB(00,80,00)
    sphx=dw-1-Abs(dw-sphx)/2
  EndIf
  
  If sphy<0
    co=RGB(00,80,00)
  sphy=(sphy*-1)/2
  EndIf
  If sphy>=dh
    co=RGB(00,80,00)
    sphy=dh-1-Abs(dh-sphy)/2
  EndIf
  
Plot(sphx,sphy,co)
EndIf
xx2+xx1
yy2+yy1
Next

ii+0.007
uu+0.0059
ii2+0.0043
uu2+0.0031

sphii.f+sphiii.f
sphuu.f+sphuuu.f
sphii2.f+sphiii2.f
sphuu2.f+sphuuu2.f

;;;;;;;;;;;
StopDrawing() 
;*****

FlipBuffers() 

Delay(1)

ExamineKeyboard() 
Until KeyboardPushed(#PB_Key_All)
ShowCursor_(1)
End 


Re: Heure locale avec des sprites

Publié : mer. 02/nov./2022 11:09
par SPH
@Micoute

Tu es sûr que tu n'oublies pas certains fichiers dans ton lien ? (je ne vois qu'un .PB)
Hors, s'il n'y a qu'un .PB, autant le mettre dans le forum...

:?

Re: Heure locale avec des sprites

Publié : mer. 02/nov./2022 11:36
par Ar-S
Lorsque tu mets des includebinary, elles ne font pas partie de ton code source elles sont juste ajoutées à ta compilation..
Donc en l'état, ton fichier .pb n'est pas exploitable ... :roll:

Re: Heure locale avec des sprites

Publié : mer. 02/nov./2022 13:20
par Micoute
Bonjour à tous et veuillez m'excuser, car j'ai l'habitude de ne travailler que pour moi, donc les fichiers inclus sont disséminés dans différents répertoires.

Je vais donc retravailler le programme pour le rendre plus convenable.

Re: Heure locale avec des sprites

Publié : mer. 02/nov./2022 14:07
par Micoute
Voilà c'est fait, vous n'avez plus qu'à retourner au premier poste où j'ai tout regroupé dans un zip.