Page 1 sur 1

la fenetre qui voulait devenir un sprite

Publié : mar. 22/juil./2008 10:12
par kernadec
bonjour
ptit truc tres pratique le (even=16)

Code : Tout sélectionner

    For i=0 To 1000 
          OpenWindow(0, 50+Random(800), 50+Random(600), 50+Random(200),  50+Random(200), "", #WS_SYSMENU|#PB_Window_BorderLess)
          StickyWindow(0, 1)
          StartDrawing(WindowOutput(0))
          DrawingMode(1)
           FrontColor(RGB(Random(255),Random(255),Random(255)))
           FillArea(0 ,0 ,RGB(Random(255),Random(255),Random(255)),RGB(Random(255),Random(255),Random(255)))
          StopDrawing()
          Repeat 
             Event = WaitWindowEvent() 
             Delay(1)
             CloseWindow(0)
             event=16
          Until Event = #PB_Event_CloseWindow
     Next i

Publié : mar. 22/juil./2008 11:15
par kernadec
encore plus rapide lol

Code : Tout sélectionner

For i=0 To 100
          OpenWindow(0, 50+Random(800), 50+Random(600), 50+Random(200),  50+Random(200), "", #WS_SYSMENU|#PB_Window_BorderLess)
          StickyWindow(0, 1)
          StartDrawing(WindowOutput(0))
          DrawingMode(1)
           FrontColor(RGB(Random(255),Random(255),Random(255)))
           FillArea(0 ,0 ,RGB(Random(255),Random(255),Random(255)),RGB(Random(255),Random(255),Random(255)))
          StopDrawing()
          Repeat 
             Event = WindowEvent() 
             CloseWindow(0)
             event=16
          Until Event = #PB_Event_CloseWindow
     Next i

Re: la fenetre qui voulait devenir un sprite

Publié : mar. 22/juil./2008 11:26
par Backup
kernadec a écrit :bonjour
ptit truc tres pratique le (even=16)
ben oui Event=16

c'est event=#PB_Event_CloseWindow !!
car #PB_Event_CloseWindow =16

étonnant non ?

et alors ? 8O
kernadec a écrit :encore plus rapide lol

Code : Tout sélectionner

For i=0 To 1000 

Code : Tout sélectionner

For i=0 To 100 
c'est plus rapide parceque tu ouvre 100 fenetres au lieu de 1000 c'est un peu normale :lol:


et lorsque tu utilise :

Code : Tout sélectionner

Repeat
             Event = WindowEvent() 
fait suivre par un Delay(2)
parceque sinon tu bouffe toute les ressources de la machine !!

voila voila .... :)

Publié : mar. 22/juil./2008 12:25
par kernadec
bonjour dobro merci pour tes conseils
aussi voila un autre exemple avec le screenshot
que tu doit connaitre aussi! lol
je doit dire que pour rafraichir les fenetres en arriere plan
cette methode est bien pratique

Code : Tout sélectionner

;#######################################################
 ;#####  07 2008 kernadec  fenetres en vrac           ###
 ;#####  pour faire des tour de passe passe windows   ###
 ;#####  en arriere plan sans attendre d'event        ###
 ;#######################################################
  hwnd=OpenWindow(0, 50, 50, 100,  100, "", #WS_SYSMENU|#PB_Window_BorderLess|#PB_Window_Invisible)   
       HideWindow(0, 1)
       CreateImage(0,100,100) 
       DC = StartDrawing(ImageOutput(0)) 
       BitBlt_(DC,0,0,ImageWidth(0),ImageHeight(0),GetDC_(hwnd),0,0,#SRCCOPY ) 
       StopDrawing()
    CloseWindow(0)
 
 For i=0 To 200
    x=50+Random(500)
    y=50+Random(500)
    xx= x=20+Random(300)
    yy=y=20+Random(300)
  
      OpenWindow(0, x, y, xx,  yy, "", #WS_SYSMENU|#PB_Window_BorderLess)
      StickyWindow(0, 1)
      StartDrawing(WindowOutput(0))
      DrawingMode(4)
      DrawImage(ImageID(0),0,0)
      StopDrawing()
 Repeat 
     Event =WindowEvent() 
;    Delay(300)              ; ralentir pour voir l'economiseur d'ecran en action lol
     CloseWindow(0)
     event=16
 Until Event = #PB_Event_CloseWindow
   hwnd=OpenWindow(0, x, y, xx,  yy, "", #WS_SYSMENU|#PB_Window_BorderLess|#PB_Window_Invisible)   
      HideWindow(0, 1)
      CreateImage(0,x,y) 
      DC = StartDrawing(ImageOutput(0)) 
      BitBlt_(DC,0,0,ImageWidth(0),ImageHeight(0),GetDC_(hwnd),0,0,#SRCCOPY ) 
      StopDrawing()
   CloseWindow(0)
 Next i