listes chainees a l'infinie

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

listes chainees a l'infinie

Message 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 
.


@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message 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 

@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Avatar de l’utilisateur
flaith
Messages : 1487
Inscription : jeu. 07/avr./2005 1:06
Localisation : Rennes
Contact :

Message par flaith »

<HS>
Sympa la statue ;)
</HS>
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message 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 
Image
Avatar de l’utilisateur
venom
Messages : 3138
Inscription : jeu. 29/juil./2004 16:33
Localisation : Klyntar
Contact :

Message 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


@++
Windows 10 x64, PureBasic 5.73 x86 & x64
GPU : radeon HD6370M, CPU : p6200 2.13Ghz
Anonyme2
Messages : 3518
Inscription : jeu. 22/janv./2004 14:31
Localisation : Sourans

Message par Anonyme2 »

Dans ton code d'origine tu peux aussi remplacer WaitWindoEvent() par WindowEvent()
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Message par Backup »

Denis a écrit :Dans ton code d'origine tu peux aussi remplacer WaitWindoEvent() par WindowEvent()
la voie de la sagesse :D
Avatar de l’utilisateur
Flype
Messages : 2431
Inscription : jeu. 29/janv./2004 0:26
Localisation : Nantes

Message 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.
Image
Anonyme2
Messages : 3518
Inscription : jeu. 22/janv./2004 14:31
Localisation : Sourans

Message 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
Répondre