Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2070
Number of posts: 5361

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
LPDIRECTDRAWSURFACE :: Release() ends everything Posted by Sagat on 17 Nov 2000 at 4:34 AM
I'm trying to deallocate images dynamically (during runtime). For example, when the title screen clears, images and buttons should be deleted. The same should occur between stages. My game contains many (50+ MB) images, and it would be inefficient otherwise. However, LPDIRECTDRAWSURFACE :: Release() ends the program immediately. In the game loop, should released (0/NULL) images not be drawn? Remember, I'm releasing surfaces used as images not the main or back buffers. No one yet has been able to answer this question, though it sounds very simple. Help will be returned.


Edit Report
Re: LPDIRECTDRAWSURFACE :: Release() ends everything Posted by KMS on 17 Nov 2000 at 9:34 AM
Need more info!<br>
<br>
But it seems that you are drawing to draw released surfaces, your program crashes right away.<br>
<br>
When I used to DirectDraw, I used this:<br>
#define CLEANRELEASE(x) if(x){(x)->Rlease();(x)=NULL;}<br>
<br>
That gurantees to set any object I release to NULL, and when I draw<br>
if( x )<br>
x->BltFast .. whatever<br>
<br>
: I'm trying to deallocate images dynamically (during runtime). For example, when the title screen clears, images and buttons should be deleted. The same should occur between stages. My game contains many (50+ MB) images, and it would be inefficient otherwise. However, LPDIRECTDRAWSURFACE :: Release() ends the program immediately. In the game loop, should released (0/NULL) images not be drawn? Remember, I'm releasing surfaces used as images not the main or back buffers. No one yet has been able to answer this question, though it sounds very simple. Help will be returned.<br>
: <br>
<br>



Edit Report
Re: Re: LPDIRECTDRAWSURFACE :: Release() ends everything Posted by Sagat on 17 Nov 2000 at 9:36 PM
: Need more info!<br>
: <br>
: But it seems that you are drawing to draw released surfaces, your program crashes right away.<br>
: <br>
: When I used to DirectDraw, I used this:<br>
: #define CLEANRELEASE(x) if(x){(x)->Rlease();(x)=NULL;}<br>
: <br>
: That gurantees to set any object I release to NULL, and when I draw<br>
: if( x )<br>
: x->BltFast .. whatever<br>
: <br>
: : I'm trying to deallocate images dynamically (during runtime). For example, when the title screen clears, images and buttons should be deleted. The same should occur between stages. My game contains many (50+ MB) images, and it would be inefficient otherwise. However, LPDIRECTDRAWSURFACE :: Release() ends the program immediately. In the game loop, should released (0/NULL) images not be drawn? Remember, I'm releasing surfaces used as images not the main or back buffers. No one yet has been able to answer this question, though it sounds very simple. Help will be returned.<br>
<br>
You probably right. I noticed my old game code didn't perform any checking or do anything but call :: Release(). Here's the updated version:<br>
<br>
void Sprite :: Free()<br>
{<br>
if (Image)<br>
{<br>
Image->Release();<br>
Image = NULL;<br>
}<br>
}<br>
<br>
It should work. Thanks.





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.