help with directdraw in windowed mode

Started by
6 comments, last by kingpinzs 18 years, 9 months ago

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);
    
    //////////////////////////////////////////////////////////////////////////

  ZeroMemory(&ddsd,sizeof(ddsd));
    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
   
 
    cutscene();
}    

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 ;
	
	g_pddsback->Blt(&rcDSrc,g_pddsone,&rcRSrc,DDBLT_WAIT,NULL);
	Flip();	
}       



void Flip(void)
{
 RECT rcRSrc;
 RECT rcDSrc;
 POINT p;
 
 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?
Advertisement
can any one please help me ?
are u using your own bitmap loader?Post the code that loads your bitmap from the file
no I am using ddutils from microsoft
can any one help?
so any one out there know hpw tp make direct Draw winodwed mode?
any one know directdraw?
why is no one responding?

This topic is closed to new replies.

Advertisement