Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Spirale performant zeichnen (https://www.delphipraxis.net/47468-spirale-performant-zeichnen.html)

glkgereon 11. Jun 2005 18:38


Spirale performant zeichnen
 
Hi

ich will eine Spirale zeichnen (und drehen)
zum ausprobieren hab ich das erst mal in blitzbasic gemacht.

jedoch komme ich mit folgendem code nur auf 8-9 fps :(

was kann ich besser machen?

Code:
maxx=1024
maxy=768
px=Int(maxx / 2)
py=Int(maxy / 2)
rad=200.0
trees = 6
rd = 360/trees

Graphics maxx,maxy,32

SetBuffer BackBuffer()

col=255

While Not KeyHit(1)

   Cls
   ;Spirale
   st=MilliSecs()
   LockBuffer BackBuffer()
   For x=-rad To rad
      For y=-rad To rad
      
      If x*x+y*y<rad*rad Then
         deg=ATan2(y,x)+180-i
         If deg<0 Then deg=(deg+360) Mod 360
         prad=Sqr(x*x+y*y)
         If prad<>0 Then deg=deg+prad*100/rad
         If (deg Mod rd > rd/2) Then col=$FFFFFF Else col=0
         WritePixelFast x+px,y+py,col
      EndIf
      
      Next
   Next
   
   UnlockBuffer BackBuffer()
   i=(i-1) Mod rd
      Text 10,10,1.0/((MilliSecs()-st)/1000.0)+" fps"
   Flip
Wend


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:36 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz