Jump to content

  • Log In with Google      Sign In   
  • Create Account

Wallpaper screws up after leaving my game


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 SpaceRook   Members   -  Reputation: 160

Like
Likes
Like

Posted 22 January 2002 - 10:31 AM

Hi all. I am working on a modest Tetris clone using DirectX under Win2000. I have a bit of a problem, though. When I exit from my game, the desktop wallpaper is centered on the desktop, with the width & height of the wallpaper equal to the resolution of my game. For example, my desktop resolution is 1024x768, and I have a wallpaper image stretched over the desktop. When I quit out of my 800x600 game, the wallpaper image is now 800x600 pixels wide and centered. Any way of fixing this? BTW, when my game''s color depth was 8 bits, the desktop wallpaper was also getting reduced to 8 bits when I left the game. I am released all my directX objects before the program ends.

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 23 January 2002 - 02:12 AM

It sounds like the main ddraw object isn''t being released correctly. Check the return value when you release it and make sure it was successfuly released.

#3 SpaceRook   Members   -  Reputation: 160

Like
Likes
Like

Posted 24 January 2002 - 06:19 AM

quote:
Original post by Anonymous Poster
It sounds like the main ddraw object isn''t being released correctly. Check the return value when you release it and make sure it was successfuly released.


It seems like the ddraw object is being release OK. My shutdown code contains the following block:

if(lpdd != NULL)
{
fprintf(file, "\nReleasing DD object");
if(FAILED(lpdd->Release()))
{
fprintf(file, "DD release failed");
}
}
fprintf(file, "\nLeaving shutdown");

The output reads:
Releasing DD object
Leaving shutdown




#4 siaspete   Members   -  Reputation: 208

Like
Likes
Like

Posted 24 January 2002 - 06:33 AM

Make sure you release all DD-created things before releasing the DD itself.

#5 SpaceRook   Members   -  Reputation: 160

Like
Likes
Like

Posted 25 January 2002 - 09:02 AM

quote:
Original post by siaspete
Make sure you release all DD-created things before releasing the DD itself.


I have isolated my problem down to the line that seems to be causing the problem (where lpddsprimary is a LPDIRECTDRAWSURFACE7):

if(lpddsprimary)
{
fprintf(file, "\n****lpdds primary not null****\n");
if(FAILED(lpddsprimary->Release()))
fprintf(file, "\nlpdds primary release failed");
}

My program seems to hang on that call to Release(). NO OUTPUT AT ALL will get written if I leave that if... statement in. However, when I comment it out, my program outputs "****lpdds primary not null****". It seems like some kind of null pointer exception, yet if the program gets into the loop, lpddsprimary obviously can''t be null!



#6 SpaceRook   Members   -  Reputation: 160

Like
Likes
Like

Posted 25 January 2002 - 09:09 AM

OK, I finally got it!!!! The order I was releasing things was screwed up. Like you suggested, I released the DD object last. But I still had to reorder the other release() calls. I could have sworn I tried that before and it didn''t work, but I guess I didn''t. Thanks for the help, everyone!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS