directives asm de purbasic?????

Pour discuter de l'assembleur
comtois
Messages : 5172
Inscription : mer. 21/janv./2004 17:48
Contact :

Message par comtois »

j'aime bien l'effet , super.J'ai supprimé les goto en espérant ne pas avoir dénaturé le code , ni dégradé les performances ,je n'ai pas fait de test de vitesse .

Code : Tout sélectionner

InitSprite()
InitKeyboard()
InitMouse()
OpenScreen(1024, 768, 32, "")

Dim tableau(1500)
Dim tableau2(1500)



X1.f
Y1.f
posi.f
a.f

emp = -100 ; amplitude de depart
negampli = -140 ; amplitude inferieur
posampli = 140 ; amplitude superieur
decomp = 0 ; vitesse

z = 0
posi = 1
limite = posi * 80
zoom = 200

Repeat
   
   ClearScreen(RGB(0, 0, 0))
   
   ;Initialise les données
   prem = 0
   x = 150
   y = 500
   a = 0
   X1 = -150
   Y1 = -150
   
   emp + decomp
   If emp > posampli Or emp < negampli
      decomp = -decomp
   EndIf
   
   For i = 1 To 1000
      tableau(i) = 1000
      tableau2(i) = 0
   Next
   
   ;Tracé
   StartDrawing(ScreenOutput())
      While a < limite
         
         ;Pour le Test des points à afficher ( gestion des points cachés ) ?
         If prem = 0 Or tableau2(x) < y + z
            tableau2(x) = y + z
         EndIf
         
         If tableau(x) >= y + z
            tableau(x) = y + z
         EndIf
         
         
         x + 1
         X1 + 0.5
         z1 = (Cos((Sqr((X1 * X1) / zoom + (Y1 * Y1) / zoom)))) * emp
         z = z1
         
         If x < 760 + a
            
            If y + z < tableau(x) Or y + z > tableau2(x) ; test les points à afficher
               Plot(x, y + z, RGB( 0 , 255 , 255))
            EndIf
            
         Else
            
            prem = 1
            x = 150
            X1 = -150
            Y1 + 3.8
            a  + posi
            y - 2
            x + a
            
         EndIf
         
      Wend
      
   StopDrawing()
   
   ;Gestion du clavier 
   ExamineKeyboard()
   
   If KeyboardPushed(#PB_Key_Left)
      posampli + 1
      negampli - 1
      emp + 1
   ElseIf KeyboardPushed(#PB_Key_Right)
      posampli - 1
      negampli + 1
      emp - 1
   EndIf
   If KeyboardPushed(#PB_Key_Up)
      zoom + 3
   ElseIf KeyboardPushed(#PB_Key_Down)
      zoom - 3
   EndIf
   
   ;Affiche le résultat
   FlipBuffers()
   
Until KeyboardPushed(#PB_Key_Escape)
ker2x
Messages : 61
Inscription : dim. 11/mai/2008 7:27

Re:

Message par ker2x »

Le Soldat Inconnu a écrit :[Intel quad core Q9400 2.66mhz, ATI 4870, 4Go Ram, Windows XP]
2.66 millihertz ! Ouaaah !
Ca fait heu ... 9.5 Cycle CPU de l'heure !! Ca rame pas trop ?
Répondre