Page 1 sur 1
					
				Effet et démos
				Publié : ven. 03/sept./2004 6:05
				par garzul
				
 Voila ici ce seras ou je posterai tout mes effet et démos produite  

  vous pourrez aussi en déposez  pour echanger des effet ou astuce d'optimisation ou de simplification (Notez comme je parle bien dans cette phrase et oui !!! Car c'est la rentrer 

) Donc voila mon code simple fait en 20 minute : 
Voici la lib que j'ai utiliser a renommer Math+  : 
Code : Tout sélectionner
 ;*****************************************************************************
;  Fonctions sinus et cosinus en degrée
DefType.f pi 
!fldpi 
!fstp dword[v_pi] 
Declare.f gSin(winkel)
Declare.f gCos(winkel)
Declare.f Hypotenus(Cote1.f,Cote2.f)
Procedure.f gsin(winkel)                              
   ProcedureReturn Sin(winkel*0.017444)
EndProcedure
Procedure.f gCos(winkel)                              
   ProcedureReturn Cos(winkel*0.017444)
EndProcedure
Procedure.f Hypotenus(Cote1.f,Cote2.f)
  !fld dword[esp] 
  !fmul st0,st0   
  !fld dword[esp+4] 
  !fmul st0,st0   
  !faddp  
  !fsqrt  
EndProcedure
Procedure.b Sgn(n.f)
  !fld dword[esp] 
  !fstp st1 
  !ftst   
  !fnstsw ax  
  !fwait
  !xor al,al
  !sahf    
  !jz near @f
  !inc al
  !;inc instruction doesn't modify CPU C flag ;)
  !jnc near @f
  !neg al
  !@@:MOVSX eax,al 
  ProcedureReturn
EndProcedure
 
Voici le code de mon premier VRAI effet 

 : 
Code : Tout sélectionner
;Initialisation des composant
InitSprite() : InitKeyboard()
IncludeFile "Math+.pb"
;Fonction ouverture de la fenetre screen
SetRefreshRate(60)
If OpenScreen(1024,768,32,"Effet Ligne tournante dans un cercle")  ; L'écran va essayer de s'ouvrir en 60hz.  
  Goto play 
Else 
  SetRefreshRate(0)
  If OpenScreen(1024,768,32,"Effet Ligne tournante dans un cercle")  
    SetFrameRate(60) 
  EndIf
EndIf
play :
;Initialisation des variable
centrex=512
centrey=384
rayon=256
angle=0
;Debug Sin(1)
; BOUCLE
Repeat
ClearScreen(0,0,0)
;Debut du dessin du cercle
StartDrawing(ScreenOutput())
    DrawingMode(1|4)
    For anglecercle=0 To 359
        x=centrex+rayon*Sin(anglecercle*0.017444)
        y=centrey+rayon*Cos(anglecercle*0.017444)
        Plot(x,y,RGB(255,0,0))        
    Next anglecercle
;Calcul des ligne 
   x1=centrex+rayon*gSin(angle)
   y1=centrey+rayon*gCos(angle)
   
   x2=centrex+rayon*gSin(angle+250)
   y2=centrey+rayon*gCos(angle+250)
;Affichage des ligne    
   LineXY(x1,y1,x2,y2,RGB(255,255,0))
   LineXY(x2,y2,x3,y3,RGB(255,255,0))
  
   Locate(0,0):FrontColor(255,255,255):DrawText(FPS$)
StopDrawing()
angle+1
angle=angle % 360
Gosub FPS
FlipBuffers(0)
ExamineKeyboard()
;Fin du programme
Until KeyboardPushed(#PB_Key_Escape)
End
;Comptage du nombre de fps
FPS  :
If Val(FormatDate("%ss", Date()))=sek
  FPS  + 1
Else
       FPS$  = Str(FPS)
       FPS  = 1
EndIf
sek  = Val(FormatDate("%ss", Date()))
Voila par contre je voudrai savoir comment réaliser la meme chose en n'utilisant pas la lib Math+ Merci a vous  

 
			 
			
					
				
				Publié : ven. 03/sept./2004 9:37
				par Psycode
				Oui, sauf que ton code ici :
Code : Tout sélectionner
;Comptage du nombre de fps 
FPS  : 
If Val(FormatDate("%ss", Date()))=sek 
  FPS  + 1 
Else 
       FPS$  = Str(FPS) 
       FPS  = 1 
EndIf 
sek  = Val(FormatDate("%ss", Date())) 
 doit devenir ceci pour que ca marche :
Code : Tout sélectionner
;Comptage du nombre de fps 
FPS: 
If Val(FormatDate("%ss", Date()))=sek 
  FPS  + 1 
Else 
       FPS$  = Str(FPS) 
       FPS  = 1 
EndIf 
sek  = Val(FormatDate("%ss", Date())) 
Return
 
			 
			
					
				
				Publié : ven. 03/sept./2004 13:24
				par Paneric
				voila un petit code pour vous amuser:
Code : Tout sélectionner
InitSprite()
InitKeyboard()
IncludeFile "Math+.pb"
OpenScreen(800,600,32,"")
centrex=400
centrey=300
rayon=400
angle=0:angle2=120:angle3=240
Structure sincos
    a.f
    b.f
EndStructure
Dim valeurs.sincos(360)
For i=0 To 360
    valeurs(i)\a=gsin(i)
    valeurs(i)\b=gcos(i)
Next i
r=rayon:r_d=1
Repeat
    ClearScreen(0,0,0)
 For i=0 To 1 
        StartDrawing(ScreenOutput())
        DrawingMode(4)
        LineXY(x1,y1,x2,y2,RGB(255-angle,255,angle))
        LineXY(x2,y2,x3,y3,RGB(255,255-angle,angle))
        LineXY(x3,y3,x1,y1,RGB(255,255,angle))
        Circle(x1,y1,15,RGB(255-angle,255,angle))
        Circle(x2,y2,15,RGB(255,255-angle,angle))
        Circle(x3,y3,15,RGB(255,255,angle))
        Circle(centrex,centrey,r,RGB(255,0,0))
        StopDrawing()
        x1=centrex+r*Valeurs(angle)\a
        y1=centrey+r*Valeurs(angle)\b
        x2=centrex+r*valeurs(angle2)\a
        y2=centrey+r*valeurs(angle2)\b
        x3=centrex+r*valeurs(angle3)\a
        y3=centrey+r*valeurs(angle3)\b
        angle+1
        angle2+1
        angle3+1
        angle=angle % 360
        angle2=angle2 % 360
        angle3=angle3 % 360
         r-r_d
        If r<32 Or r>rayon
            r_d=-r_d
        EndIf
    Next i
    Gosub FPS
    StartDrawing(ScreenOutput())
    DrawingMode(1)
    Locate(0,0):FrontColor(255,255,255):DrawText("Fps :"+FPS$)
    StopDrawing()
    FlipBuffers(1)
    ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
FPS  :
If Val(FormatDate("%ss", Date()))=sek
  FPS  + 1
Else
       FPS$  = Str(FPS)
       FPS  = 1
EndIf
sek  = Val(FormatDate("%ss", Date()))
Return
Paneric
 
			 
			
					
				
				Publié : ven. 03/sept./2004 14:42
				par Dr. Dri
				demo de garzul : 64 de FPS
demo de paneric : 90 de FPS
c'est sympa tout ca ^^
Dri
			 
			
					
				
				Publié : ven. 03/sept./2004 16:23
				par Paneric
				Merci dr dri,
il existe beaucoup de variante dérivée de ce code. je vous en prépare d'autre.
Paneric
			 
			
					
				
				Publié : ven. 03/sept./2004 16:40
				par Paneric
				une autre variante
Code : Tout sélectionner
InitSprite()
InitKeyboard()
IncludeFile "Math+.pb"
OpenScreen(800,600,32,"")
centrex=400
centrey=300
rayon=300:r=rayon
angle.f=0
Repeat
 ClearScreen(0,0,0)
For r=rayon To 127 Step -2
        StartDrawing(ScreenOutput())
        DrawingMode(4)
        LineXY(x1,y1,x2,y2,RGB(255-angle,255,angle))
        LineXY(x2,y2,x3,y3,RGB(255,255-angle,angle))
        LineXY(x3,y3,x1,y1,RGB(255,255,angle))
        Circle(x1,y1,15,RGB(255-angle,255,angle))
        Circle(x2,y2,15,RGB(255,255-angle,angle))
        Circle(x3,y3,15,RGB(255,255,angle))
        Circle(centrex,centrey,r,RGB(255,0,0))
        StopDrawing()
        x1=centrex+r*gsin(angle)
        y1=centrey+r*gcos(angle)
        x2=centrex+r*gsin(angle+120)
        y2=centrey+r*gcos(angle+120)
        x3=centrex+r*gsin(angle+240)
        y3=centrey+r*gcos(angle+240)
        angle+4
        If angle>359.99
            angle=0
       EndIf
Next r
    Gosub FPS
    StartDrawing(ScreenOutput())
    DrawingMode(1)
    Locate(0,0):FrontColor(255,255,255):DrawText("Fps :"+FPS$)
    StopDrawing()
    FlipBuffers(1)
    ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
FPS  :
If Val(FormatDate("%ss", Date()))=sek
  FPS  + 1
Else
       FPS$  = Str(FPS)
       FPS  = 1
EndIf
sek  = Val(FormatDate("%ss", Date()))
Return
paneric
 
			 
			
					
				
				Publié : ven. 03/sept./2004 16:45
				par garzul
				
 Genial j'aore l'effet ( Bon bah moi je vais essayer d'en faire un beaux 

 ) Vraiment jolie par contre es-que quelqu-un pourai me le convertir sans la lib a paneric ? (Pour que je comprenne la trigo )
 
			 
			
					
				
				Publié : dim. 05/sept./2004 22:24
				par garzul
				
 Salut comme je l'ai dit je met mes création dans ce topics (Pour ne pas polluer le forum avec plein de topics parlant de la meme chose ) Voila ma démos avec plein de math ouf (Vous en rappelez que j'etais nul en math bah oui mais vous voyez j'arrive a faire sa 

 bon voici le code : 
Code : Tout sélectionner
;==============CODER PAR JULIEN (Garzul) Le 4 septembre a 00 : 00==================================
;Initialisation des composant
InitSprite() : InitKeyboard()
;Inclue le fichier math +
IncludeFile "Math+.pb"
;Ouvre l'ecran
OpenScreen(1024,768,32,"Garzul Mathematique")
;Variable des figure géometrique
Centrex = 512
Centrey = 384
Rayon   = 256
Angle   = 0
Rayon2  = 150
VitRayon = 1
VitRayon2 = 2
Lignex = 55
Ligney = -100
Grosseur = 50
GrosseurVit = 1
Longeur = 50
LongeurVit = 2
Carrex = 125
Carrey = 384
axx = 290
ayy = 384
ixx  = 390
iyy  = 384
Pointxx = 394
Pointyy = 300
Demixx  = 100
Demiyy  = 600
GouTxx  = 280
GouTyy  = 600
Gouxx   = 430
Gouyy   = 600
Figxx   = 590
Figyy   = 600
Fig1x   = 750
Fig1y   = 600
Toutx   = 925
Touty   = 600
T = 0
Tvit    = 1
Declare NuanceArP()
;Initialisation des variable pour l'affichge d'arriere plan
Global Rouge,Vert,Bleu
Rouge = 0
Vert  = 0
Bleu  = 0
;Procedure de changement de couleur d'arriere plan
Procedure NuanceArP()
     Vert + 1
  
  If Rouge > 200
    Rouge  - 2
    Vert   + 1
  EndIf
  
  If Vert > 200
    Vert  - 2
    Bleu  + 1
  EndIf
  
  If Bleu > 200
    Vert = 0
    Bleu = 0
    Rouge = 0  
  EndIf
  
  
EndProcedure 
 
;Boucle
Repeat
  ClearScreen(Rouge,Vert,Bleu)
;On dessine sur l'écran
StartDrawing(ScreenOutput())
;Ecriture ecran
DrawingMode(1)
DrawText("Je dédis ce programme aux programmeur du forum de PureBasic.FR")
;dessine la figure geometrique modifier du cercle
  For AngleCercle = 0 To 359
  
    x = Centrex + Rayon * Gsin(AngleCercle + 2)
    y = Centrey + Rayon * gcos(AngleCercle * 2)
    Plot(x,y,RGB($07,$0B,$BF))
    
  Next AngleCercle  
;Dessine le cercle
    For AngleCercle = 0 To 359
  
      b = Centrex + Rayon2 * Gsin(AngleCercle)
      n = Centrey + Rayon2 * Gcos(AngleCercle)
      Plot(b,n,RGB($07,$0B,$BF))
    
    Next AngleCercle  
;Dessine le scan line
      For Ligne = 0 To 60
      
      
        Lix = Lignex + Longeur * Sin(Ligne)
        Liy = Ligney + Grosseur * Cos(Ligne)
        Line(Lix,Liy,918,0,RGB($EA,$28,$15))
      
      Next Ligne
  
  
     ;Ecriture mathematique de "Moi Garzul "
           For Carrer = 0 To 200
      
      
             Carx = Carrex + 80 * Sin(Carrer * 2)
             Cary = Carrey + 80 * Cos(Carrer * 8)
             
             Plot(Carx,Cary,RGB($87,$1D,$78))
      
          Next Carrer
 
            For o = 0 To 20000
      
      
              ax = axx + 80 * Sin(o) * Cos(o / 200)
              ay = ayy + 80 * Cos(o)
             
              Plot(ax,ay,RGB($87,$1D,$78))
              
            Next o
              For i = 0 To 150
      
                ix = ixx + 2 * Sin(i)
                iy = iyy + 70 * Cos(i)
             
                Line(ix,iy,10,2,RGB($87,$1D,$78))
              
              Next i
                For Pointi = 0 To 500
      
                  Pointix = Pointxx + 5 * Sin(Pointi) * Cos(Pointiy)
                  Pointiy = Pointyy + 5 * Cos(pointi) * Sin(Pointix)
             
                  Plot(Pointix,Pointiy,RGB($87,$1D,$78))
              
                Next Pointi
;-Logos
;Ecriture de Logo(Losange)+Logo autre
                  For DemiCercle = 0 To 500
      
                    Demix = Demixx + 80 * Sin(DemiCercle) * Cos(DemiCercle / 20)
                    Demiy = Demiyy + 80 * Cos(DemiCercle) * Sin(DemiCercle / 20)
             
                    Plot(Demix,Demiy,RGB($E5,$E9,$1A))
              
                  Next DemiCercle  
                    For Goutte = 0 To 300
      
                      GouTx = GouTxx + 80 * Sin(Goutte) * Cos(Goutte * 1)
                      GouTy = GouTyy + 80 * Cos(Goutte) * Sin(Goutte * 2)
             
                      Plot(GouTx,GouTy,RGB($18,$11,$E7))
              
                    Next Goutte
                      For Goute = 0 To 300
      
                        Goux = Gouxx + 80 * Sin(Goute) * Cos(Goute / 2)
                        Gouy = Gouyy + 80 * Cos(Goute)
             
                        Plot(Goux,Gouy,RGB($3E,$E5,$C1))
              
                      Next Goute
                        For Figur = 0 To 300
      
                          Figx = Figxx + 80 * Sin(Figur) * Cos(Figur * 3)
                          Figy = Figyy + 80 * Cos(Figur) * Sin(Figur * 4)
             
                          Plot(Figx,Figy,RGB($A3,$F6,$5C))
              
              
                        Next Figur
                        
                        
                            For Figu1 = 0 To 300
      
                              Fi1x = Fig1x + 80 * Sin(Figu1) * Cos(Figu1 * 3)
                              Fi1y = Fig1y + 80 * Cos(Figu1)
                              
                              Plot(Fi1x,Fi1y,RGB($7F,$18,$80))
              
                            Next Figu1
                            
                            ; Tout effet
                            ; Tout Les effet en meme temps et plus 
                            For Tout = 0 To 300
      
                              Touta= Toutx + 80 * Sin(Tout) * Cos(Tout * t)
                              Toutb= Touty + 80 * Cos(Tout)
                              
                              Plot(Touta,Toutb,RGB($B8,$21,$47))
              
                            Next Tout
StopDrawing()
;Grossisement des figure au centre de l'ecran (Cercle + CercleCouper)
Rayon - VitRayon
If Rayon < 5
   VitRayon =- VitRayon
   
EndIf   
 
If Rayon > 300
   VitRayon =- VitRayon
   
EndIf   
Rayon2 - VitRayon2
If Rayon2 < 20
   VitRayon2 =- VitRayon2
EndIf
    
If Rayon2 > 300
   VitRayon2 =- VitRayon2
   
EndIf
       
;-Avance des ligne
Longeur + LongeurVit
If Longeur > 150
   LongeurVit = - LongeurVit
   
EndIf
If Longeur < - 150
   LongeurVit = - LongeurVit
   
EndIf
   
Grosseur + GrosseurVit
If Grosseur > 150
   GrosseurVit =- GrosseurVit
   
EndIf
   
If Grosseur < 49
   GrosseurVit =- GrosseurVit
EndIf
 
  Ligney + 3
  
  If Ligney > 900
  
    Ligney - Ligney
    
  EndIf 
   
   
   ;Actualisation des figure géometrique
   t + Tvit
   If t > 100
   
      tvit =- Tvit
      
   EndIf
   
   If t < -1
   
      Tvit =- Tvit
      
   EndIf
   
   
   ;aFFICHAGE DE LA PROCEDURE 
  NuanceArP()
;Inversement des buffer videos
  FlipBuffers()
;Fin du programme (OUF)^^
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
End
 
			 
			
					
				
				Publié : lun. 06/sept./2004 16:40
				par Dr. Dri
				@paneric
c'est une spirale (ultra) de la mort lol
d'ailleurs t'as aussi tué le FPS (15) super en tout cas
@garzul
c'est sympa ton truc, un peu bordelique à regarder lol
il m'a fallu un petit bout de temps pour tout distinguer ^^
Dri
			 
			
					
				
				Publié : lun. 06/sept./2004 16:43
				par garzul
				
 Merci dri mais bon vu le nombre de remerciement que j'ai sa doit pas etres super lol bon c'est pas tout mais je retourne coder  

 
			 
			
					
				
				Publié : lun. 06/sept./2004 17:14
				par Oliv
				Nana c'est très sympa Garzul 

 , mais on a pas forcément des réponses surs tous nos sujets (regarde mon bot irc ou mon serveur pop)
 
			 
			
					
				
				Publié : lun. 06/sept./2004 17:54
				par Paneric
				@dr dri 
je suis étonné que tu soit à 15 FPS chez moi je suis à 60 FPS.
Merci quand même, je n'ai rien optimisé. Ces codes était pour montrer à Garzul quelques effets avec des lignes et cercles. et lui donner l'envie de montrer ce qu'il pouvait en tirer.
@Garzul,
Il est vrai que cela est un peu fouilli mais j'aime bien ce tu as fait.
Paneric