
je vais voir plus tard
@++
; by Venom
; arrangé par Dobro ;
Global Dim tableau.S (6)
Enumeration
#sprite_bleu
#sprite_rouge
#window
EndEnumeration
initsprite ()
If openwindow ( #window , 0, 0, 600, 400, "Binary Clock" , #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered )
openwindowedscreen ( windowid ( #window ),0,0,600,400,1,0,0)
setframerate (25)
fontid = loadfont (8, "Arial Black" , 95, #PB_Font_Bold )
F2 = loadfont (9, "Arial Black" , 9, #PB_Font_Bold )
; ********* creation de sprite *************
createsprite ( #sprite_rouge ,55,55)
startdrawing ( spriteoutput ( #sprite_rouge ))
c=1
For i=27 To 2 Step -2
circle (25, 25, i, rgb (0, c, 0))
c=c+10
Next i
stopdrawing ()
createsprite ( #sprite_bleu ,50,50)
startdrawing ( spriteoutput ( #sprite_bleu ))
circle (25, 25, 25, rgb (0, 0, 30))
stopdrawing ()
; ***************************************
addwindowtimer ( #window , 123,1000)
Repeat
Event = waitwindowevent (2)
Select Event
Case#PB_Event_Gadget
Case #PB_Event_Timer
If eventtimer () = 123
If startdrawing ( screenoutput ())
y=320 : x=580
drawingfont (F2)
drawtext (x, y, "1" , rgb (0, 255, 0), rgb (0, 0, 0)) :y-50
drawtext (x, y, "2" , rgb (0, 255, 0), rgb (0, 0, 0)) :y-50
drawtext (x, y, "4" , rgb (0, 255, 0), rgb (0, 0, 0)) :y-50
drawtext (x, y, "8" , rgb (0, 255, 0), rgb (0, 0, 0))
drawingfont ( fontid )
date$ = formatdate ( "%hh:%ii:%ss" , date ())
drawtext (0, -30, date$, rgb (0, 100, 0), rgb (0, 0, 0))
heure_dizaine$= mid ( bin ( val ( left ( stringfield (date$,1, ":" ),1))),1,2)
heure_unite$= mid ( bin ( val ( right ( stringfield (date$,1, ":" ),1))),1,4)
minute_dizaine$= mid ( bin ( val ( left ( stringfield (date$,2, ":" ),1))),1,3)
minute_unite$= mid ( bin ( val ( right ( stringfield (date$,2, ":" ),1))),1,4)
seconde_dizaine$= mid ( bin ( val ( left ( stringfield (date$,3, ":" ),1))),1,3)
seconde_unite$= mid ( bin ( val ( right ( stringfield (date$,3, ":" ),1))),1,4)
;{ ******** dessine le decors **********************
Restore sprite_bleu:
; ++++++++++ dizaine heur bleu +++++++++
For o=1 To 6
Read n
Read p
y=300
For i=1 To n
displaysprite ( #sprite_bleu ,p,y)
y=y-50
Next i
Next o
; ++++++++++++++++++++++++++++++++++++++
;}
;{ affichage de l'heure
; ++++++++++ dizaine heur rouge +++++++++
tableau.S (1)=heure_dizaine$
tableau.S (2)=heure_unite$
tableau.S (3)=minute_dizaine$
tableau.S (4)=minute_unite$
tableau.S (5)=seconde_dizaine$
tableau.S (6)=seconde_unite$
Restore sprite_rouge
For o=1 To 6
Read y
Read n
Read p
var$=tableau.S (o)
For i=1 To n
If len (var$)<n
var$= "0" +var$
EndIf
If mid (var$,i,1)= "1"
displaytransparentsprite ( #sprite_rouge ,p,y)
EndIf
y=y+50
Next i
Next o
; ++++++++++++++++++++++++++++++++++++++
;} ++++++++++++++++++++++++++++++++++++++
stopdrawing ()
EndIf
EndIf
; ; ++++++++++++++++++++++++++++++++++++++
flipbuffers ()
clearscreen ( rgb (0,0,0))
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
DataSection
sprite_bleu:
Data.i 2,50,4,100,3,250,4,300,3,450,4,500
sprite_rouge:
Data.i 250,2,50,150,4,100,200,3,250,150,4,300,200,3,450,150,4,500
EndDataSection
J'aime beaucoup cette varianteDobro a écrit :et voici une petite Variante