Page 1 sur 1

listes chainees a l'infinie

Publié : sam. 15/juil./2006 15:59
par venom
bonjour,

voila tout est dans le titre. j'ai cree une fenetre qui a l'ouverture affiche trois cercles de couleurs differante ( r, g , b). mais des que les trois sont afficher bin forcement sa s'arrete est-ce possible de les faire apparaitre a l'infinie.

voici un exemple.

Code : Tout sélectionner

Procedure cercle()
StartDrawing(WindowOutput(0))
For rayon=0 To 1 
    For rayon= 0 To 300 
      Circle(400, 300, Rayon,RGB(255,0,0)) 
    Next rayon
 Next rayon
StopDrawing()

StartDrawing(WindowOutput(0))
For rayon=0 To 1 
    For rayon= 0 To 300 
     Circle(400, 300, Rayon,RGB(0,255,0))
    Next rayon
 Next rayon
StopDrawing()

StartDrawing(WindowOutput(0))
For rayon=0 To 1 
    For rayon= 0 To 300 
      Circle(400, 300, Rayon,RGB(0,0,255)) 
    Next rayon
 Next rayon
StopDrawing()
EndProcedure

If OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
 If CreateGadgetList(WindowID(0))

cercle()

 EndIf
EndIf

Repeat
 EventID = WaitWindowEvent() 
  
  Until EventID = #PB_Event_CloseWindow 
End 
.


@++

Publié : sam. 15/juil./2006 16:16
par venom
re, :D

bin je vien de trouver a moitier la solution car j'au lancer ma rocedure apres le

Code : Tout sélectionner

 EventID = WaitWindowEvent()
. plus tot apres

Code : Tout sélectionner

CreateGadgetList(WindowID(0))
. donc la c'est bon sa defile a l'infinie mais le nouveau probleme c'est que quand je ne bouge pas la souris dans la fenetre bin les cercles arretent d'apparaitre :o c'est bizarre nan ?

nouveau code

Code : Tout sélectionner

Procedure cercle()
StartDrawing(WindowOutput(0))
For rayon=0 To 1 
    For rayon= 0 To 300 
      Circle(400, 300, Rayon,RGB(255,0,0)) 
    Next rayon
 Next rayon
StopDrawing()

StartDrawing(WindowOutput(0))
For rayon=0 To 1 
    For rayon= 0 To 300 
     Circle(400, 300, Rayon,RGB(0,255,0))
    Next rayon
 Next rayon
StopDrawing()

StartDrawing(WindowOutput(0))
For rayon=0 To 1 
    For rayon= 0 To 300 
      Circle(400, 300, Rayon,RGB(0,0,255)) 
    Next rayon
 Next rayon
StopDrawing()
EndProcedure

If OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
 If CreateGadgetList(WindowID(0))

 EndIf
EndIf

Repeat
 EventID = WaitWindowEvent() 
  cercle()
  Until EventID = #PB_Event_CloseWindow 
End 

@++

Publié : sam. 15/juil./2006 16:20
par flaith
<HS>
Sympa la statue ;)
</HS>

Publié : sam. 15/juil./2006 16:34
par Flype
avec un thread c'est le plus simple (ou alors fait une recherche sur les 'timers' fur le forum).

Code : Tout sélectionner

Global Quitter

Procedure cercle(delai.l) 
  
  While Not Quitter
    Delay(delai)
    If StartDrawing(WindowOutput(0)) 
      For rayon=0 To 1 
        For rayon=0 To 300 
          Circle(400, 300, Rayon, #Red) 
        Next  
      Next  
      For rayon=0 To 1 
        For rayon=0 To 300 
         Circle(400, 300, Rayon, #Green) 
        Next  
      Next 
      For rayon=0 To 1 
        For rayon=0 To 300 
          Circle(400, 300, Rayon, #Blue) 
        Next
      Next 
      StopDrawing() 
    EndIf
  Wend
  
EndProcedure 

If OpenWindow(0, 0, 0, 800, 600, "test", #PB_Window_ScreenCentered | #PB_Window_SystemMenu) 
  CreateThread(@cercle(), 20)
  Repeat 
  Until WaitWindowEvent() = #PB_Event_CloseWindow 
  Quitter = #True
EndIf 

Publié : sam. 15/juil./2006 16:45
par venom
:lol:
<HS>
Sympa la statue
</HS>
oui je t'avoue que je trouve aussi qu'elle a la classe 8). c'est d'ailleur pour sa que je l'ai acheter :wink: :) .
avec un thread c'est le plus simple (ou alors fait une recherche sur les 'timers' fur le forum).
je te remercie grandement flype je n'aurais jamais su que c'etait de cette façon la maintenant je le serais :wink: . thank's


@++

Publié : sam. 15/juil./2006 17:59
par Anonyme2
Dans ton code d'origine tu peux aussi remplacer WaitWindoEvent() par WindowEvent()

Publié : sam. 15/juil./2006 18:09
par Backup
Denis a écrit :Dans ton code d'origine tu peux aussi remplacer WaitWindoEvent() par WindowEvent()
la voie de la sagesse :D

Publié : sam. 15/juil./2006 18:24
par Flype
Denis a écrit :Dans ton code d'origine tu peux aussi remplacer WaitWindoEvent() par WindowEvent()
et depuis la v4, on peut remplacer WaitWindowEvent(), par WaitWindowEvent(25) où 25 représente le 'timeout' à adapter en fonction du rendu voulu (1) pour le max de vitesse.

Publié : sam. 15/juil./2006 19:36
par Anonyme2
Flype a écrit :
Denis a écrit :Dans ton code d'origine tu peux aussi remplacer WaitWindoEvent() par WindowEvent()
et depuis la v4, on peut remplacer WaitWindowEvent(), par WaitWindowEvent(25) où 25 représente le 'timeout' à adapter en fonction du rendu voulu (1) pour le max de vitesse.
J'aime bien le 25, c'est mon département :jesors:

Flype, ta méthode avec le Thread est de loin la meilleure