Page 1 of 1

Posted: Sun Jun 09, 2002 4:13 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

Hi Guys!

Ive coded for my mp3 player a graphiceffect with sinus and cosins and it works fine but there is a hidden bug that i cant find after a while it steal all my RAM, does anybody know where the bug is?

Code: Select all

  StartDrawing(WindowOutput())    
  
       FrontColor(0,0,50)
       Box(0,30,225,35)   
      
       FrontColor(0,250,0)
       line_x + 1
       If line_x > 220
         line_x = - 20
       EndIf
       Line(line_x,45,250,0)
       Line(line_x - 250,45,250,0)      
       
       FrontColor(250,0,0)
       Line(line_x,43,250,0)
       Line(line_x - 250,43,250,0)  
        
      For x = 1 To 200
          sin_y = 5 * Sin(x)
          cos_y = 10 * Cos(x)
          
          cos_x + 4
            If cos_x > 250
               cos_x = - 30
            EndIf
           
          sin_x - 4 
            If sin_x < 0
               sin_x = 210
            EndIf 
       
       FrontColor(255,0,0)
       Plot(sin_x,sin_y+45)
       FrontColor(0,255,0)
       Plot(cos_x,cos_y+43)
     Next
     
 StopDrawing()
http://www.purehilfe.de.vu

Posted: Sun Jun 09, 2002 4:29 pm
by BackupUser
Restored from previous forum. Originally posted by fweil.

Hello,

I tested it like the following (just added a ground window) and it takes 952KB of memory according to windows task manager on W2K. It seems to work fine.

If OpenWindow(0, 0, 0, 640, 480, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget, "")

StartDrawing(WindowOutput())

FrontColor(0,0,50)
Box(0,30,225,35)

FrontColor(0,250,0)
line_x + 1
If line_x > 220
line_x = - 20
EndIf
Line(line_x,45,250,0)
Line(line_x - 250,45,250,0)

FrontColor(250,0,0)
Line(line_x,43,250,0)
Line(line_x - 250,43,250,0)

For x = 1 To 200
sin_y = 5 * Sin(x)
cos_y = 10 * Cos(x)

cos_x + 4
If cos_x > 250
cos_x = - 30
EndIf

sin_x - 4
If sin_x < 0
sin_x = 210
EndIf

FrontColor(255,0,0)
Plot(sin_x,sin_y+45)
FrontColor(0,255,0)
Plot(cos_x,cos_y+43)
Next

StopDrawing()

Repeat

Until WaitWindowEvent() = #PB_EventCloseWindow

EndIf

CloseWindow(0)

End

Francois Weil
14, rue Douer
F64100 Bayonne

Posted: Sun Jun 09, 2002 11:56 pm
by BackupUser
Restored from previous forum. Originally posted by blue-speed.

u have to put it in the repat until loop then look again plz

http://www.purehilfe.de.vu

Posted: Mon Jun 10, 2002 4:22 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Just post a full working source.
I cant see a Repeat...Until in your source.

cya,
...Danilo

(registered PureBasic user)