Advertisement Jump to content
Sign in to follow this  
KittyRa

WIN32 game turns white

This topic is 4880 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making space pong in WIN32 (my school doesn't have DirectX). Everything works fine until about a minute into play when the paddles and ball turn white. There are stars moving in the background but they don't turn white (they are not yellowish). Does anyone know why this happens/how I can fix it? thanks

Share this post


Link to post
Share on other sites
Advertisement
I am using GDI. The ball and paddles are just RECTs that I filled using FillRect()

Here's the code for drawing the paddles:
paddle.top		= PADDLE2_START_Y;
paddle.left = PADDLE2_START_X;
paddle.right = PADDLE2_START_X+PADDLE_WIDTH;
paddle.bottom = PADDLE2_START_Y+PADDLE_HEIGHT;

FillRect(ghdc,&p1,CreateSolidBrush(RGB(255,0,0)));
FillRect(ghdc,&p2,CreateSolidBrush(RGB(0,0,255)));

Share this post


Link to post
Share on other sites
You need to delete the brushes after usage. Otherwise, they fill up the memory reserved for GDI, thus causing "empty" graphics and/or crashes.

I recommend creating the brushes just once after you've created the window, and deleting them when the application is closing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!