Displaying pictures in directdraw(windowed mode)

Started by
0 comments, last by Toonkides 20 years, 2 months ago
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
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]
StevieDon't follow me, I'm lost.

This topic is closed to new replies.

Advertisement