Hi, I'm using this code to display images on the screen:
Code:DXImage.Items[0].Draw(DXDraw1.Surface,round(x),round(y),0);
I realized that every image loaded used more and more memory. How to release the memory used by the surface?
Hi, I'm using this code to display images on the screen:
Code:DXImage.Items[0].Draw(DXDraw1.Surface,round(x),round(y),0);
I realized that every image loaded used more and more memory. How to release the memory used by the surface?
You can do that by not loading the images at design-time, but during run-time. However if you go that route you'll need to distribute the images with you executable.
Also a call to <object>.free might come in handy. Do this after you are done displaying it and move to the next screen.
http://3das.noeska.com - create adventure games without programming
I understand, but I use the picture for 30 seconds and do not need it after that. Is there a way to release memory?Originally Posted by Traveler
I'll do that then I say if it workedOriginally Posted by noeska
Thanks o/
Its been a while I used DelpphiX but iirc you can create an object TDirectDrawSurface and then use that to load and draw the image. When you nolonger need it you can release the object again.
Thanks everyone
I will do thisOriginally Posted by Traveler
I found a good example... \o/
http://www.pascalgamedevelopment.com...fd42d1f7cf82f6
Memory is managed internaly, you can use DxDraw1.ClearStack for force prune texture stack manually. But new restoring all used next screen texture consume more times, you be sure, that example level finished or menu screen is loaded etc.
Ijcro.
Bookmarks