当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTDRAW::CreateSurface方法代码示例

本文整理汇总了C++中LPDIRECTDRAW::CreateSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAW::CreateSurface方法的具体用法?C++ LPDIRECTDRAW::CreateSurface怎么用?C++ LPDIRECTDRAW::CreateSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTDRAW的用法示例。


在下文中一共展示了LPDIRECTDRAW::CreateSurface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitDDraw

BOOL InitDDraw()
{
	DDSURFACEDESC ddsd;
	HRESULT ddrval;

	DirectDrawCreate(NULL, &lpDD, NULL);//产生一个DDRAW对象。
	/*第一个参数是要创建的驱动类型,设为NULL,表示使用当前的显示驱动
	第三个参数用于今后与COM对象兼容,目前都设为NULL*/

	lpDD->SetCooperativeLevel (hWnd, DDSCL_NORMAL);//设置协作级别

	ZeroMemory( &ddsd, sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS;
	/*主页面的大小和像素格式都是由当前的显示模式决定的,
	所以不能指定,否则发生错误*/
	ddsd.ddsCaps .dwCaps = DDSCAPS_PRIMARYSURFACE;
	ddrval = lpDD->CreateSurface (&ddsd, &lpDDSPrimary, NULL);
	/*第三个参数也是用于与COM对象兼容,目前只能设为NULL*/
	if(ddrval != DD_OK)
	{
		return FALSE;
	}
	
	ZeroMemory( &ddsd, sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS| DDSD_HEIGHT| DDSD_WIDTH;
	ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
	ddsd.dwHeight = 600;
	ddsd.dwWidth = 800;
	/*页面的大小可以和实际图片大小不一样,但会产生失真*/

	RectTemp.left = 0;
	RectTemp.top = 0;
	RectTemp.right = ddsd.dwWidth;
	RectTemp.bottom = ddsd.dwHeight;
	

	lpDD->CreateSurface (&ddsd, &lpDDSTemp, NULL);
	if(ddrval != DD_OK)
	{
		return FALSE;
	}

	DDReLoadBitmap( lpDDSTemp, "gameover.bmp");

	return TRUE;

}
开发者ID:jollywing,项目名称:jolly-code-snippets,代码行数:49,代码来源:init_ddraw.cpp

示例2: DDLoadBitmap

/*
 * DDLoadBitmap:
 *      create a DirectDrawSurface from a bitmap resource.
 */
LPDIRECTDRAWSURFACE DDLoadBitmap(LPCSTR szBitmap, int dx, int dy)
{
    HBITMAP             hbm;
    BITMAP              bm;
    DDSURFACEDESC       ddsd;
    IDirectDrawSurface  *pdds;
    
    hbm = (HBITMAP)LoadImage(NULL, szBitmap, IMAGE_BITMAP, dx, dy, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
    
    if (hbm == NULL) {
        return NULL;
    }
    
    // get size of the bitmap
    GetObject(hbm, sizeof(bm), &bm);      // get size of bitmap
    
    // create a DirectDrawSurface for this bitmap
    ZeroMemory(&ddsd, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
    ddsd.dwWidth = bm.bmWidth;
    ddsd.dwHeight = bm.bmHeight;
    
    if (lpDD->CreateSurface(&ddsd, &pdds, NULL) != DD_OK) {
        return NULL;
    }
    
    DDCopyBitmap(pdds, hbm, 0, 0, 0, 0);
    
    DeleteObject(hbm);
    
    return pdds;
}
开发者ID:mreiferson,项目名称:dod,代码行数:38,代码来源:dodddraw.cpp

示例3: DDCreateSurface

LPDIRECTDRAWSURFACE DDCreateSurface(int width, int height, int mem_flags)
{
    DDSURFACEDESC ddsd;         // working description
    LPDIRECTDRAWSURFACE lpdds;  // temporary surface
    
    // set to access caps, width, and height
    memset(&ddsd, 0, sizeof(ddsd));
    ddsd.dwSize  = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
    
    // set dimensions of the new bitmap surface
    ddsd.dwWidth  =  width;
    ddsd.dwHeight =  height;
    
    // set surface to offscreen plain
    ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | mem_flags;
    
    // create the surface
    if (lpDD->CreateSurface(&ddsd, &lpdds, NULL) != DD_OK) {
        return(NULL);
    }
    
    // return surface
    return(lpdds);
}
开发者ID:mreiferson,项目名称:dod,代码行数:25,代码来源:dodddraw.cpp

示例4: Initiate

//------------------------------------------------------------
// Name: Initiate
// Desc: Init everything
//------------------------------------------------------------
int Initiate()
{
	// create dd object and test for an error
	hr = DirectDrawCreate(NULL,&lpdd,NULL);
	if (DDFailedCheck(hr, "DirectDrawCreate failed", cpErrorBuf ))
		return 0;
	
	// set cooperation level to windowed mode normal
	hr = lpdd->SetCooperativeLevel(main_window_handle,  DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | 
														DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT   );
	if (DDFailedCheck(hr, "SetCooperativeLevel", cpErrorBuf ))
		return 0;

	// set the display mode. use this for full screen programs
	hr = lpdd->SetDisplayMode(WINDOW_WIDTH ,WINDOW_HEIGHT,16);
	if (DDFailedCheck(hr, "SetDisplayMode", cpErrorBuf ))
		return 0;

	// Create the primary surface
	memset(&ddsd,0,sizeof(ddsd));//clear ddsd structure
	ddsd.dwSize         = sizeof(ddsd);
	ddsd.dwFlags        = DDSD_CAPS;
	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

	hr = lpdd->CreateSurface(&ddsd,&lpddsprimary,NULL);
	if (DDFailedCheck(hr, "CreateSurface", cpErrorBuf ))
		return 0;

	// return success
	return(1);
}//End Initiate
开发者ID:scirelli,项目名称:testForDX5,代码行数:35,代码来源:WinMain.cpp

示例5: memset

static gxj_pixel_type*
startDirectPaint(int &dstWidth, int &dstHeight, int &dstYPitch) {
    gxj_pixel_type *dst = NULL;

#if JWC_WINCE_USE_DIRECT_DRAW
    if (isScreenRotated() || !isScreenFullyVisible() || editBoxShown) {
        /* DDraw is not very reliable on an rotated screen. Use GDI instead. */
        return NULL;
    }

    if (g_pDD == NULL) {
        /* DirectDraw failed to initialize. Let's use GDI to Blit to the LCD. */
        return NULL;
    }

    HRESULT hRet;
    DDSURFACEDESC surfaceDesc;
    DDSURFACEDESC ddsd;

    if (g_pDDSPrimary == NULL) {
        /* Create the primary surface with 0 back buffer */
        memset(&ddsd, 0, 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) {
            g_pDDSPrimary = NULL;
            return NULL;
        }
    }

    surfaceDesc.dwSize = sizeof(surfaceDesc);
    hRet = g_pDDSPrimary->Lock(NULL, &surfaceDesc,
                               DDLOCK_DISCARD | DDLOCK_WRITEONLY, NULL);
    if (hRet == DD_OK) {
        dst = (gxj_pixel_type*)surfaceDesc.lpSurface;
        dstWidth = surfaceDesc.dwWidth;
        dstHeight = surfaceDesc.dwHeight;
        dstYPitch = surfaceDesc.lPitch;
    } else {
        /* Release the DD resources. Maybe we'd get lucky and can allocate
         * it next time.
         */
        g_pDDSPrimary->Release();
        g_pDDSPrimary = NULL;
        return NULL;
    }
#else
    if (editBoxShown) {
        return NULL;
    }
    dstWidth = gxDispProps.cxWidth;
    dstHeight = gxDispProps.cyHeight;
    dstYPitch = gxDispProps.cbyPitch;
    dst = (gxj_pixel_type*)GXBeginDraw();
#endif

    return dst;
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:60,代码来源:winceapp_export.cpp

示例6: memset

HRESULT
CVWRenderRoot::CreateBackBuffer(LPDIRECTDRAW pdd, int cx, int cy, VARIANT_BOOL bUseHWAcceleration, IDirectDrawSurface **ppddsBackBuffer)
{
	DDSURFACEDESC	ddsd;

	// it would be bad to try and create a zero-sized backbuffer
	if (cx <= 0)
		cx = 1;
	if (cy <= 0)
		cy = 1;
	
	// Create a back buffer.
	HRESULT hRes;
    memset(&ddsd,0,sizeof(DDSURFACEDESC));
    ddsd.dwSize = sizeof( ddsd );
    ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
	ddsd.dwWidth = cx;
	ddsd.dwHeight = cy;
	if (bUseHWAcceleration)
		ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_VIDEOMEMORY;
	else
		ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_SYSTEMMEMORY;
	hRes = pdd->CreateSurface( &ddsd, ppddsBackBuffer, NULL );

	if (FAILED(hRes))
		return hRes;

	//
	// attach the palette if one exists
	//
	if (m_pPalette && FAILED(hRes = (*ppddsBackBuffer)->SetPalette(m_pPalette)))
		return hRes;

	return S_OK;
}
开发者ID:opensim4opencog,项目名称:PrologVirtualWorlds,代码行数:35,代码来源:vwrendrt.cpp

示例7: DDInitFullscreen

int DDInitFullscreen(int width, int height, int bpp, HWND hwnd)
{
    HRESULT ret;
    
    // create object and test for error
    if (DirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) {
        return(0);
    }
    
    // set cooperation level to windowed mode normal
    if (lpDD->SetCooperativeLevel(hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) != DD_OK) {
        return(0);
    }
    
    // set the display mode
    if (lpDD->SetDisplayMode(width, height, bpp) != DD_OK) {
        return(0);
    }
    
    // set globals
    screen_height = height;
    screen_width = width;
    screen_bpp = bpp;
    
    // Create the primary surface
    memset(&ddsd, 0, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
    
    // we need to let dd know that we want a complex
    // flippable surface structure, set flags for that
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
    
    // set the backbuffer count to 1
    ddsd.dwBackBufferCount = 1;
    
    // create the primary surface
    ret = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL);
    
    // query for the backbuffer i.e the secondary surface
    ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
    lpDDSPrimary->GetAttachedSurface(&ddscaps, &lpDDSBack);
    
    // clear out both primary and secondary surfaces
    DDFillSurface(lpDDSPrimary, 0);
    DDFillSurface(lpDDSBack, 0);
    
    DDGetRGB16();
    
    return 1;
}
开发者ID:mreiferson,项目名称:dod,代码行数:51,代码来源:dodddraw.cpp

示例8: InitOwnSurface

LPDIRECTDRAWSURFACE TAGameAreaReDrawer::InitOwnSurface (LPDIRECTDRAW TADD)
{
	if (NULL!=GameAreaSurfaceFront_ptr)
	{
		GameAreaSurfaceFront_ptr->Release ( );
		GameAreaSurfaceFront_ptr= NULL;
	}

	if (NULL!=GameAreaSurfaceBack_ptr)
	{
		GameAreaSurfaceBack_ptr->Release ( );
		GameAreaSurfaceBack_ptr= NULL;
	}

	RECT GameAreaRect;

	if (TADD)
	{
		TAWGameAreaRect ( &GameAreaRect);

		DDSURFACEDESC ddsd;
		DDRAW_INIT_STRUCT(ddsd);
		ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
		ddsd.dwWidth = GameAreaRect.right- GameAreaRect.left;
		ddsd.dwHeight = GameAreaRect.bottom- GameAreaRect.top;

		TADD->CreateSurface( &ddsd, &GameAreaSurfaceFront_ptr, NULL);
		TADD->CreateSurface( &ddsd, &GameAreaSurfaceBack_ptr, NULL);
		
	
		Cls ( );
	}
	
	return GameAreaSurfaceFront_ptr;
}
开发者ID:jchristi,项目名称:taddraw,代码行数:36,代码来源:GameRedrawer.cpp

示例9: CreateSurfByGafFrame

LPDIRECTDRAWSURFACE CreateSurfByGafFrame (LPDIRECTDRAW LpDD, PGAFFrame Cursor_P, bool VidMem)
{
	//PCXPic.buffer= (unsigned char *)malloc (	SizeofResource ( HInstance, FResource));
	if (NULL==Cursor_P)
	{
		return NULL;
	}
	PGAFFrame GafFrame= Cursor_P;
	
	LPDIRECTDRAWSURFACE RetSurf= NULL;

	LPBYTE GafBits;
	POINT GafSize;
	InstanceGAFFrame ( GafFrame, &GafBits, &GafSize);

	DDSURFACEDESC ddsd;
	DDRAW_INIT_STRUCT(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
	if(VidMem)
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
	else
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
	ddsd.dwWidth = GafSize.x;
	ddsd.dwHeight = GafSize.y;

	LpDD->CreateSurface ( &ddsd, &RetSurf, NULL);

	DDRAW_INIT_STRUCT(ddsd);

	RetSurf->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);

	unsigned char *SurfPTR = (unsigned char*)ddsd.lpSurface;
	if (NULL!=SurfPTR)
	{
		for(int i=0; i<GafSize.y; i++)
		{
			memcpy(&SurfPTR[i*ddsd.lPitch], &GafBits[i*GafSize.x], GafSize.x);
		}
	}
	free ( GafBits);
	RetSurf->Unlock(NULL);
	

	
	return RetSurf;
}
开发者ID:jchristi,项目名称:taddraw,代码行数:46,代码来源:gaf.cpp

示例10: mfc_render_init

BOOL mfc_render_init(HWND hWnd)
{
	DDSURFACEDESC    ddsd;
	DDCAPS           ddcaps;

	HRESULT          hRet;

	///////////////////////////////////////////////////////////////////////////
	// Create the main DirectDraw object
	///////////////////////////////////////////////////////////////////////////
	hRet = DirectDrawCreate(NULL, &g_pDD, NULL);
	if (hRet != DD_OK)
		return PRINT_ERRMSG(TEXT("DirectDrawCreate FAILED"));

	// Get exclusive mode
	hRet = g_pDD->SetCooperativeLevel(hWnd, DDSCL_NORMAL);
	if (hRet != DD_OK)
		return PRINT_ERRMSG(TEXT("SetCooperativeLevel FAILED"));


	// Get a primary surface interface pointer (only needed for init.)

	memset(&ddsd, 0, 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)
		return PRINT_ERRMSG(TEXT("CreateSurface FAILED"));

	// See if we can support overlays.
	memset(&ddcaps, 0, sizeof(ddcaps));
	ddcaps.dwSize = sizeof(ddcaps);
	hRet = g_pDD->GetCaps(&ddcaps, NULL);
	if (hRet != DD_OK)
		return PRINT_ERRMSG(TEXT("GetCaps FAILED"));

	if (ddcaps.dwOverlayCaps == 0)
		return PRINT_ERRMSG(TEXT("Overlays are not supported in hardware!"));


	// SW YUV->RGB conversion table initialization
	_initConvTab();

	return TRUE;
}
开发者ID:HITEG,项目名称:TenByTen6410_SLC,代码行数:46,代码来源:mfc_render.cpp

示例11: DDInitWindowed

int DDInitWindowed(int width, int height, int bpp, HWND hwnd)
{
    HRESULT ret;
    
    // create object and test for error
    if (DirectDrawCreate(NULL, &lpDD, NULL) != DD_OK) {
        return(0);
    }
    
    // set cooperation level to windowed mode normal
    if (lpDD->SetCooperativeLevel(hwnd, DDSCL_NORMAL) != DD_OK) {
        return(0);
    }
    
    // set globals
    screen_height = height;
    screen_width = width;
    screen_bpp = bpp;
    
    // Create the primary surface
    memset(&ddsd, 0, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);
    ddsd.dwFlags = DDSD_CAPS;
    
    // all we need for windowed mode is access to the primary surface
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
    
    // create the primary surface
    ret = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL);
    
    // create an offscreen and system mem back surface
    lpDDSBack = DDCreateSurface(width, height, NULL);
    
    lpDD->CreateClipper(0, &lpDDClipper, NULL);
    lpDDClipper->SetHWnd(0, hwnd);
    lpDDSPrimary->SetClipper(lpDDClipper);
    
    // clear out both primary and secondary surfaces
    DDFillSurface(lpDDSPrimary, 0);
    DDFillSurface(lpDDSBack, 0);
    
    DDGetRGB16();
    
    return 1;
}
开发者ID:mreiferson,项目名称:dod,代码行数:45,代码来源:dodddraw.cpp

示例12: screen_size

PRBool
nsWindowGfx::InitDDraw()
{
  HRESULT hr;

  hr = DirectDrawCreate(NULL, &glpDD, NULL);
  NS_ENSURE_SUCCESS(hr, PR_FALSE);

  hr = glpDD->SetCooperativeLevel(NULL, DDSCL_NORMAL);
  NS_ENSURE_SUCCESS(hr, PR_FALSE);

  DDSURFACEDESC ddsd;
  memset(&ddsd, 0, sizeof(ddsd));
  ddsd.dwSize = sizeof(ddsd);
  ddsd.dwFlags = DDSD_CAPS;
  ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
  ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

  hr = glpDD->CreateSurface(&ddsd, &glpDDPrimary, NULL);
  NS_ENSURE_SUCCESS(hr, PR_FALSE);

  hr = glpDD->CreateClipper(0, &glpDDClipper, NULL);
  NS_ENSURE_SUCCESS(hr, PR_FALSE);

  hr = glpDDPrimary->SetClipper(glpDDClipper);
  NS_ENSURE_SUCCESS(hr, PR_FALSE);

  // We do not use the cairo ddraw surface for IMAGE_DDRAW16.  Instead, we
  // use an 24bpp image surface, convert that to 565, then blit using ddraw.
  if (!IsRenderMode(gfxWindowsPlatform::RENDER_IMAGE_DDRAW16)) {
    gfxIntSize screen_size(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
    gpDDSurf = new gfxDDrawSurface(glpDD, screen_size, gfxASurface::ImageFormatRGB24);
    if (!gpDDSurf) {
      /*XXX*/
      fprintf(stderr, "couldn't create ddsurf\n");
      return PR_FALSE;
    }
  }

  return PR_TRUE;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:41,代码来源:nsWindowGfx.cpp

示例13: Create_BOB

int Create_BOB(BITMAP_OBJ_PTR bob, int width, int height, int attr, int flags)
{
	DDSURFACEDESC ddsd;
	bob->state = BOB_STATE_ALIVE;
	bob->attr = attr;
	bob->image = NULL;
	bob->x = bob->y = bob->xv = bob->yv = 0;
	memset(&ddsd, 0, sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
	ddsd.dwWidth = bob->width = width;
	ddsd.dwHeight = bob->height = height;
	ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | flags;
	if (lpdd->CreateSurface(&ddsd, &(bob->image), NULL)!=DD_OK)
		return (0);
	DDCOLORKEY color_key;
	color_key.dwColorSpaceHighValue = 0;
	color_key.dwColorSpaceLowValue = 0;
	(bob->image)->SetColorKey(DDCKEY_SRCBLT, &color_key);

	return (1);
}
开发者ID:domino14,项目名称:SpaceWars2,代码行数:22,代码来源:gfx.cpp

示例14: q_initDD

void q_initDD()
{
    if (initialized)
        return;

    DirectDrawCreate(NULL, &g_pDD, NULL);

    HRESULT h;
    h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL);

    if (h != DD_OK)
        qDebug() << "cooperation level failed";

    h = g_pDD->TestCooperativeLevel();
    if (h != DD_OK)
        qDebug() << "cooperation level failed test";

    DDSURFACEDESC ddsd;
    memset(&ddsd, 0, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);

    ddsd.dwFlags = DDSD_CAPS;

    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

    h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL);

    if (h != DD_OK)
        qDebug() << "CreateSurface failed!";

    if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK)
        qDebug() << "GetCaps failed";

    q_lock();
    q_unlock();
    initialized = true;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:37,代码来源:ddhelper.cpp

示例15: set_fullscreen

//must be the game window
int dd_Window::set_fullscreen(int w, int h, int bpp)
{
	_ASSERTE(bGameWindow);

	quad ws;
	HRESULT hr;


	DX_RELEASE(dx_os);
	DX_RELEASE(dx_ps);
	DX_RELEASE(dx_win_ps);

	hr = dx_dd->SetCooperativeLevel(hMainWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
	if (hr != DD_OK)
	{
		return 0;
	}

	//hack for 320x200 letterboxing
	if(w == 320 && h == 200)
		dx_dd->SetDisplayMode(320, 240, bpp);
	else
		dx_dd->SetDisplayMode(w, h, bpp);


	hr = dx_dd->CreateSurface(&dx_psd, &dx_ps, NULL);
	if (hr != DD_OK)
	{
		return 0;
	}


	dx_osd.dwWidth=w;
	dx_osd.dwHeight=h;
	hr=dx_dd->CreateSurface(&dx_osd,&dx_os,NULL);
	if(hr!=DD_OK)
	{
		return 0;
	}
	hr = dx_ps->GetAttachedSurface(&dx_bsd.ddsCaps, &dx_bs);
	if (hr != DD_OK)
	{
		DX_RELEASE(dx_os);
		return 0;
	}

	ws = GetWindowLong(hwnd, GWL_STYLE);
	ws &= ~WS_OVERLAPPEDWINDOW;
	ws |= WS_POPUP;
	SetWindowLong(hwnd, GWL_STYLE, ws);
	SetWindowPos(hwnd,0,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE|SWP_FRAMECHANGED | SWP_NOZORDER);

	//make window take up entire screen
	//choose one or the other
	//SetWindowPos(hwnd,0,0,0,w,h,SWP_NOACTIVATE | SWP_NOZORDER);
	ShowWindow(hwnd,SW_SHOWMAXIMIZED);

	//set pixelformat parameters
	{
		DDPIXELFORMAT ddpf;
		ddpf.dwSize = sizeof(ddpf);
		ddpf.dwFlags = DDPF_RGB;
		hr = dx_ps->GetPixelFormat(&ddpf);
		if (hr != DD_OK) err("Could not get pixel format!");
		//if (ddpf.dwRBitMask == 0x7C00 && bpp == 16)
		//	vid_bpp = 15, vid_bytesperpixel = 2;
		//else
		//	vid_bpp = bpp, vid_bytesperpixel = bpp / 8;
		vid_bpp = 32;
	}


	if(img) delete img;
	img = new image();
	img->shell = true;

	SetHandleImage(1,img);
	screen = img;

//	img->alphamap = 0;
	img->width = w;
	img->height = h;
	img->cx1 = 0;
	img->cx2 = w-1;
	img->cy1 = 0;
	img->cy2 = h-1;
	img->data=0;

	flip_fullscreen();

	return 1;
}
开发者ID:Bananattack,项目名称:verge3,代码行数:93,代码来源:vid_ddbase.cpp


注:本文中的LPDIRECTDRAW::CreateSurface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。