Jump to content
  • Advertisement
Sign in to follow this  

help with directdraw in windowed mode

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

void ddrawinlize()
{ HWND hwnd;
    hRet = DirectDrawCreateEx(NULL, (void**)&g_pdd,IID_IDirectDraw7, NULL);
    if (hRet != DD_OK)
    MessageBox(hwnd,"DirectDrawCreateEX Failed","Error",0);
   // hRet = g_pdd->SetCooperativeLevel(hwnd,DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
   hRet = g_pdd->SetCooperativeLevel(hwnd, DDSCL_NORMAL);
    if (hRet != DD_OK)
    MessageBox(hwnd,"SetCooperativelevel failed","Error",0);
   // hRet = g_pdd ->SetDisplayMode(800, 600,16,0,0);
    //if (hRet != DD_OK)
    //MessageBox(hwnd,"SetDisplayMode failed","Error",NULL);

    ddsd.dwSize = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS;
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE ;
  hRet = g_pdd->CreateSurface(&ddsd, &g_pddsprimary, NULL);
     if (hRet != DD_OK)
    MessageBox(hwnd,"CreateSurface failed","Error",0);

    //-- Create the back buffer
    ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
    // Make our off-screen surface 320x240
		ddsd.dwWidth = 640;
		ddsd.dwHeight = 480;
		// Create an offscreen surface
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;

		hRet = g_pdd->CreateSurface(&ddsd, &g_pddsback, NULL);
		if (hRet != DD_OK)
    MessageBox(hwnd,"CreateSurface failed","Error",0);

   // Create the clipper using the DirectDraw object
		hRet = g_pdd->CreateClipper(0, &g_pClipper, NULL);
		if (hRet != DD_OK)
    MessageBox(hwnd,"CreateClipper failed","Error",0);

		// Assign your window's HWND to the clipper
		hRet = g_pClipper->SetHWnd(0, hwnd);
		if (hRet != DD_OK)
    MessageBox(hwnd,"CreateClipper failed","Error",0);
  g_pddsone = DDLoadBitmap(g_pdd, "//test.bmp",0,0);// this is not used

void cutscene()
     RECT rcRSrc;
 RECT rcDSrc;

	// Draw the background to the screen.
	rcRSrc.left = 0;
	rcRSrc.top = 0;
	rcRSrc.right = 640;
	rcRSrc.bottom = 480;

rcDSrc.left =0;
rcDSrc.top = 0;
rcDSrc.right = 640 ;
rcDSrc.bottom = 480 ;

void Flip(void)
 RECT rcRSrc;
 RECT rcDSrc;
 p.x = 0; p.y = 0;
 ClientToScreen(hwnd, &p);
 GetClientRect(hwnd, &rcDSrc);
 OffsetRect(&rcRSrc, 640, 480);
 g_pddsprimary->Blt( &rcDSrc, g_pddsback, &rcRSrc ,  DDBLT_WAIT, NULL );


I can not see my bit map that it loads. Any one know why?

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.

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!