Jump to content
  • Advertisement

Archived

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

Toonkides

Displaying pictures in directdraw(windowed mode)

This topic is 5305 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 have been trying to display a picture for the ddraw app, and I am using a bmp reader that I got out of a book(big mistake?) it has been hard to initialize the palette and even draw when I converted to windowed mode so now I am trying to just use the windows commands to replace the custom ones in book. I am using the WM_PAINT function, let me list code:
case WM_PAINT:
		hdcClient = BeginPaint(hwnd,&ps);
		hdcWindow = GetWindowDC(hwnd);
		RECT rect;
		GetClientRect(hwnd,&rect);
		rect.left=0; rect.right=SCREEN_WIDTH;
		rect.top=0; rect.bottom=SCREEN_HEIGHT;
		lpPrimary->Blt(&rect,lpBackground,&rect,DDBLT_WAIT,NULL);
		ReleaseDC(hwnd,hdcWindow);
		EndPaint(hwnd,&ps);
		return 0;
I run into a problem when I run this--Is it because I am doing my surfaces wrong? I have an lpPrimary, and an lpSecondary--lpBackground would be my background surface which I would assume just gets blitted to the secondary then from secondary to primary to be drawn...with page flipping, it''s fine, but with windowed it gets confusing

Share this post


Link to post
Share on other sites
Advertisement
The lines in your code:

RECT rect;
GetClientRect(hwnd,&rect);
rect.left=0; rect.right=SCREEN_WIDTH;
rect.top=0; rect.bottom=SCREEN_HEIGHT;

first fill your rectangle structure with the window area, then you overwrite the structure with the screen area.

Deleting the last two lines in the section quoted should make a difference.

Hope it helps.


Stevie

Don't follow me, I'm lost.

[edited by - Stevie56 on February 7, 2004 7:39:59 AM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!