Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Noods

Display areas??

This topic is 6153 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

OK I''m stuck. I dont know how you tell Windows where to display an image. Lets say I wanted to make Tetris. I create a background and leave the area where you manipulate the falling blocks a solid color. How do I tell Windows that I want to make that area the area that the blocks can travel in. Or how do I tell it where to display any image at all?!?! Noods

Share this post


Link to post
Share on other sites
Advertisement
If you''re using standard GDI you draw everything in response to WM_PAINT message, or in MFC''s case in OnDraw() function.

When processing WM_PAINT, you should call BeginPaint() (obtaining CDC) when starting the paint process, and EndPaint() when you finish it.

You should then set a timer that invalidates the screen (or modified display area) and moves the blocks down. After this you call UpdateWindow() which will then cause WM_PAINT (or OnDraw()) to be called. Invalidation & Update should also occur when user input is received and block is moved as a result.

Share this post


Link to post
Share on other sites
Oops, seems like I answered wrong question

Back to original subject, if you have your window open, you can draw just anywhere inside it you want. Of course you should make your own bounding coordinates for the area where blocks are falling. I''m not sure if Windows provides any handy clipping functions, but you can just avoid drawing outside the box. Each time you change something on the screen, in order for that area to be updated, you have to call InvalidateRect() function, and supply modified area rectangle as a parameter.

Share this post


Link to post
Share on other sites

  • 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!