Skip to main content
gamedev.net
🔒 Locked

LPDIRECTDRAWSURFACE :: Release()?

Started by Sagat Oct 23, 2000 at 9:53 AM 4 replies 1.1k views
Original Post
Sagat
Sagat
How do I deallocate images dynamically (between stages)? For example, when the title screen is cleared, images should be deleted. _However > Release() ends the program immediately_. Maybe it''s something else? Trying to draw a Release()d or NULL surface ends the program? HELP.
-Sagat
goir
goir
I hope you don''t do that on the primary surface or the direct draw object.
Sagat
Sagat
No. I''m trying to deallocate IMAGES. The primary and back surfaces are SCREENS. There''d be no reason to delete them (except in WM_DESTROY). For example, when the title screen clears, buttons and logos should be deleted. And images should be freed between stages. My question seems pretty clear.

Assume Image is an LPDIRECTDRAWSURFACE of class Sprite. This ends the program:

Sprite :: ~Sprite()
{
Image->Release();
Image = 0;
}

-Sagat
-Sagat
Ironblayde
Ironblayde
There''s no distinction made between IMAGES and SCREENS. A DirectDraw surface is a DirectDraw surface, regardless of whether you''re using it to store images or render frames of animation. I don''t see any reason why you couldn''t just create a set of surfaces in the beginning of the program, and then apply images to them as you needed, and release the surfaces at shutdown time. But releasing a surface in the middle of a program is really no different -- it''s not like the program knows whether it''s about to be finished or not. You just call the Release() method, like you''re doing. The only problem would be like goir said, if you do this to the primary surface or something like that. If your program crashes when you call Release() for a regular offscreen surface, then you''re doing something else wrong.

-Ironblayde
 Aeon Software

The following sentence is true.
The preceding sentence is false.
"Your superior intellect is no match for our puny weapons!"
Sagat
Sagat
Image and screen are my terminology. They''re both 2D pixel arrays, but a screen points to the VGA. It makes perfect sense. If you knew much about game/graphics, you''d know an image, screen and "surface" are the same. Stop trying to prove how smart you are, just because you cannot answer a question.

PS: Thanks Digital!

-Sagat
-Sagat

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.