I'm pretty new to miniB3D and I'm a little confused, I'm making a game using miniB3D (so easy to use) and JV-ODE which I bought. As I'm coding I noticing that FreeEntity doesn't seem to free the memory being used by the objects.
I just modded for demonstation purposes the primitives example included with miniB3D. If I add tons of balls and then remove them the ram doesn't free up.
I'm probably doing something wrong but I swear I don't know what. Help Plz !
I just modded for demonstation purposes the primitives example included with miniB3D. If I add tons of balls and then remove them the ram doesn't free up.
I'm probably doing something wrong but I swear I don't know what. Help Plz !
Import "minib3d.bmx" Local width=640,height=480,depth=16,mode=0 Graphics3D width,height,depth,mode Local cam=CreateCamera() PositionEntity cam,0,0,-10 Local light=CreateLight(1) Local MrBall:TestBall Global tex=LoadTexture("examples\media\test.png") Global BallList:TList=CreateList() ;' used by camera code Local mxs#=0 Local mys#=0 Local move#=0.5 MouseXSpeed() ;' flush MouseYSpeed() ;' flush ;' used by fps code Local old_ms=MilliSecs() Local renders Local fps While Not KeyDown(KEY_ESCAPE) If KeyHit(KEY_ENTER) Then DebugStop ;'' control camera ;' mouse look If KeyDown(KEY_SPACE)=False mxs#=mxs#+(MouseXSpeed()/5.0) mys#=mys#+(MouseYSpeed()/5.0) RotateEntity cam,mys#,-mxs#,0 MoveMouse width/2,height/2 EndIf If KeyDown(Key_1) Then TestBall.Add FlushKeys EndIf If KeyDown(Key_2) Then If CountList(BallList) > 0 Then For MrBall = EachIn BallList 'Sloppy way to get last Ball Next MrBall.Remove FlushKeys EndIf EndIf MouseXSpeed() ;' flush MouseYSpeed() ;' flush ;' move camera forwards/backwards/left/right with cursor keys If KeyDown(KEY_UP)=True Then MoveEntity cam,0,0,move# ;' move camera forward If KeyDown(KEY_DOWN)=True Then MoveEntity cam,0,0,-move# ;' move camera back If KeyDown(KEY_LEFT)=True Then MoveEntity cam,-move#,0,0 ;' move camera left If KeyDown(KEY_RIGHT)=True Then MoveEntity cam,move#,0,0 ;' move camera right For MrBall = EachIn BallList MrBall.Spin Next RenderWorld renders=renders+1 ;' calculate fps If MilliSecs()-old_ms>=1000 old_ms=MilliSecs() fps=renders renders=0 EndIf Text 0,0,"FPS: "+fps Text 0,15,"Mem in Use: " + ((GCMemAlloced()) / 1000) + " KBs" Text 0,30,"Balls in World: "+CountList(BallList) Text 0,60,"Press 1 to Add a Ball" Text 0,75,"Press 2 to Remove a Ball" Flip Wend End Type TestBall Field BallEntity Function Add() Local obj:TestBall obj:TestBall = New TestBall obj.BallEntity=CreateSphere(24) PositionEntity obj.BallEntity,CountList(BallList)*3,0,0 EntityTexture obj.BallEntity,tex ListAddLast(BallList,obj:TestBall) End Function Method Remove() FreeEntity BallEntity BallList.Remove Self End Method Method Spin() TurnEntity BallEntity,0.2,1,0.1 End Method End Type