本文整理汇总了C++中LPDIRECTDRAWSURFACE::Blt方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE::Blt方法的具体用法?C++ LPDIRECTDRAWSURFACE::Blt怎么用?C++ LPDIRECTDRAWSURFACE::Blt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE::Blt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTextMarker
void AlliesWhiteboard::DrawTextMarker(LPDIRECTDRAWSURFACE DestSurf, int X, int Y, char *cText, char C)
{
int x = X - *MapX + 128;
int y = Y - *MapY + 32;
DDBLTFX ddbltfx;
DDRAW_INIT_STRUCT(ddbltfx);
ddbltfx.ddckSrcColorkey.dwColorSpaceLowValue = 102;
ddbltfx.ddckSrcColorkey.dwColorSpaceHighValue = 102;
RECT Dest;
Dest.left = x-TextMarkerWidth/2;
Dest.top = y-TextMarkerHeight/2;
Dest.right = Dest.left+TextMarkerWidth;
Dest.bottom = Dest.top+TextMarkerHeight;
RECT Source;
Source.left = C*TextMarkerWidth;
Source.top = 0;
Source.right = Source.left+TextMarkerWidth;
Source.bottom = TextMarkerHeight;
if(DestSurf->Blt(&Dest, lpSmallCircle, &Source, DDBLT_ASYNC | DDBLT_KEYSRCOVERRIDE, &ddbltfx)!=DD_OK)
{
DestSurf->Blt(&Dest, lpSmallCircle, &Source, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &ddbltfx);
}
Dialog *pDialog = (Dialog*)LocalShare->Dialog;
pDialog->DrawText(DestSurf, x+TextMarkerWidth , y-5, cText);
}
示例2: DrawTextInput
void AlliesWhiteboard::DrawTextInput(LPDIRECTDRAWSURFACE DestSurf)
{
Dialog *DialogPTR = (Dialog*)LocalShare->Dialog;
int BFHalfX = (LocalShare->ScreenWidth-128)/2 + 128;
int BFHalfY = (LocalShare->ScreenHeight-64)/2 + 32;
if(CurrentElement)
DialogPTR->DrawText(DestSurf, BFHalfX-InputBoxWidth/2+5, BFHalfY-InputBoxHeight/2-13, "Edit Textmarker");
else
DialogPTR->DrawText(DestSurf, BFHalfX-InputBoxWidth/2+5, BFHalfY-InputBoxHeight/2-13, "Add Textmarker");
DDBLTFX ddbltfx;
DDRAW_INIT_STRUCT(ddbltfx);
ddbltfx.ddckSrcColorkey.dwColorSpaceLowValue = 102;
ddbltfx.ddckSrcColorkey.dwColorSpaceHighValue = 102;
RECT Dest;
Dest.left = BFHalfX-InputBoxWidth/2;
Dest.top = BFHalfY-InputBoxHeight/2;
Dest.right = Dest.left+InputBoxWidth;
Dest.bottom = Dest.top+InputBoxHeight;
if(DestSurf->Blt(&Dest, lpInputBox, NULL, DDBLT_ASYNC | DDBLT_KEYSRCOVERRIDE, &ddbltfx)!=DD_OK)
{
DestSurf->Blt(&Dest, lpInputBox, NULL, DDBLT_WAIT | DDBLT_KEYSRCOVERRIDE, &ddbltfx);
}
DialogPTR->DrawSmallText(DestSurf, BFHalfX-(InputBoxWidth/2)+14, BFHalfY-5, Text);
//draw cursor if textbox overlap
if((MouseX-128)>Dest.left-10 && (MouseX-128)<Dest.right && (MouseY-32)>Dest.top-34 && (MouseY-32)<Dest.bottom)
DialogPTR->BlitCursor(DestSurf, MouseX-128, MouseY-32);
}
示例3: flip_fullscreen
void dd_Window::flip_fullscreen()
{
int i=0;
HRESULT hr;
//hack for 320x200 letterboxing
if(xres == 320 && yres == 200)
{
hr = dx_bs->BltFast(0,20,dx_os,NULL,DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
DDBLTFX ddbltfx;
memset(&ddbltfx, 0, sizeof(DDBLTFX));
ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwFillColor = 0;
RECT rBlit;
rBlit.left = 0; rBlit.top = 0; rBlit.right = 320; rBlit.bottom = 20;
dx_bs->Blt(&rBlit, 0, 0, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
rBlit.left = 0; rBlit.top = 220; rBlit.right = 320; rBlit.bottom = 240;
dx_bs->Blt(&rBlit, 0, 0, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
}
//regular case
else
hr = dx_bs->BltFast(0,0,dx_os,NULL,DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
if(hr==DDERR_SURFACELOST)
{
dx_bs->Restore();
dx_os->Restore();
dx_bs->BltFast(0,0,dx_os,NULL,DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY);
}
hr=dx_ps->Flip(0,DDFLIP_WAIT | DDFLIP_NOVSYNC);
//dx_ps->Flip(0,0);
if(hr==DDERR_SURFACELOST)
{
dx_ps->Restore();
hr=dx_ps->Flip(0,DDFLIP_WAIT | DDFLIP_NOVSYNC);
}
hr=dx_os->Lock(0,&dx_osd,DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY | DDLOCK_WAIT,0);
if(hr==DDERR_SURFACELOST)
{
dx_os->Restore();
hr=dx_os->Lock(0,&dx_osd,DDLOCK_SURFACEMEMORYPTR | DDLOCK_WRITEONLY | DDLOCK_WAIT,0);
}
dx_os->Unlock(0);
img->data=(quad*)dx_osd.lpSurface;
img->pitch=dx_osd.lPitch/vid_bytesperpixel;
}
示例4: flip
bool flip(long bltWidth,long bltHeight){
if (m_ddsback==0) return true;
if (m_IS_USER_BACK_BUFFER){
if ((bltWidth>0)&&(bltHeight>0)){
RECT rt; rt.left=0; rt.top=0;
rt.right=bltWidth; rt.bottom=bltHeight;
#ifdef WINCE
HRESULT ddrval=m_ddsprimary->Blt(&rt,m_ddsback, &rt,DDBLT_WAITNOTBUSY, NULL);
#else
HRESULT ddrval=m_ddsprimary->BltFast(0,0, m_ddsback, &rt, NULL);
#endif
return (ddrval == DD_OK);
}else
return true;
}else{ //flip
while( true ) {
HRESULT ddrval= m_ddsprimary->Flip( NULL, DDFLIP_WAIT );// 交换表面
if( ddrval == DD_OK )
return true;
if( ddrval == DDERR_SURFACELOST ) {
ddrval = m_ddsprimary->Restore();
if( ddrval!= DD_OK )
return false;
}
if( ddrval != DDERR_WASSTILLDRAWING ){
return false;
}
::Sleep(0);
}
}
}
示例5: EraseScreen
//-----------------------------------------------------------------------------
// Name: EraseScreen()
// Desc:
//-----------------------------------------------------------------------------
VOID EraseScreen()
{
// Erase the background
DDBLTFX ddbltfx;
ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
ddbltfx.dwSize = sizeof(ddbltfx);
#ifdef NONAMELESSUNION
ddbltfx.u5.dwFillColor = g_dwFillColor;
#else
ddbltfx.dwFillColor = g_dwFillColor;
#endif
while( 1 )
{
HRESULT hr = g_pddsBackBuffer->Blt( NULL, NULL, NULL,
DDBLT_COLORFILL, &ddbltfx );
if( SUCCEEDED(hr) )
return;
if( hr == DDERR_SURFACELOST )
{
if( FAILED( RestoreSurfaces() ) )
return;
}
if( hr != DDERR_WASSTILLDRAWING )
return;
}
}
示例6: _GameProc
void CALLBACK _GameProc(HWND hWnd, UINT message, UINT wParam, DWORD lParam)
{
static int Frame = 0, Count = 0;
RECT BackRect = { 0, 0, 640, 480 }, SpriteRect;
BackScreen -> BltFast( 0, 0, BackGround, &BackRect, DDBLTFAST_WAIT | DDBLTFAST_NOCOLORKEY );
SpriteRect.left = Frame * 100;
SpriteRect.top = 0;
SpriteRect.right = SpriteRect.left + 100;
SpriteRect.bottom = 70;
BackScreen -> BltFast( MouseX - 50, MouseY - 35, SpriteImage, &SpriteRect, DDBLTFAST_WAIT | DDBLTFAST_SRCCOLORKEY );
// enter animation code here!
if(gFullScreen)
RealScreen->Flip(NULL, DDFLIP_WAIT);
else{
RECT WinRect, SrcRect={0, 0, gWidth, gHeight};
GetWindowRect(MainHwnd, &WinRect);
RealScreen->Blt(&WinRect, BackScreen, &SrcRect, DDBLT_WAIT, NULL );
}
}
示例7: sizeof
STDMETHODIMP
CeE2DPage::BitBlt(ICeE2DPage *pdest, LONG destx, LONG desty, LONG width, LONG height, LONG srcx, LONG srcy, LONG rop) {
HRESULT hr;
LPDIRECTDRAWSURFACE lpddsDest = NULL;
DWORD bltFlags = 0;
DDBLTFX ddbltfx;
RECT rectdest;
RECT rectsrc;
if (pdest == NULL) return E_FAIL;
hr = ((CeE2DPage *)pdest)->get_lpdds(&lpddsDest);
if (FAILED(hr)) return hr;
bltFlags = DDBLT_ROP;
ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwROP = rop;
rectdest.left = destx;
rectdest.top = desty;
rectdest.right = destx + width - 1;
rectdest.bottom = desty + height - 1;
rectsrc.left = srcx;
rectsrc.top = srcy;
rectsrc.right = rectdest.right;
rectsrc.bottom = rectdest.bottom;
hr = lpddsDest->Blt(&rectdest, this->m_lpDDS, &rectsrc, bltFlags, &ddbltfx);
if (FAILED(hr)) {
return hr;
}
return NOERROR;
}
示例8: WinProc
HRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_PAINT:
if(flag)
{
RectClient = GetClientRect(hWnd, diff_x, diff_y);
HRESULT ddrval = lpDDSPrimary->Blt (&RectClient,
lpDDSTemp, &RectTemp, DDBLT_WAIT, NULL);
if(ddrval == DDERR_SURFACELOST)
{
ddrval = lpDDSPrimary->Restore();
if (ddrval != DD_OK)
break;
}
}
return 0; //这里一定要是return,而不是break,否则不显示画面
case WM_DESTROY:
FreeDDraw();
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
示例9: fillSurface
void DXGame::fillSurface(LPDIRECTDRAWSURFACE lpdds,COLORREF color)
{
DDBLTFX fx;
ZeroMemory(&fx, sizeof(fx));
fx.dwSize = sizeof(fx);
fx.dwFillColor = color;
lpdds->Blt(NULL,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT,&fx);
}
示例10: updateFrame
extern "C" void updateFrame(void)
{
HRESULT ddrval;
RECT destRect, rcRect;
POINT pt;
if (!useDirectDraw)
{
noddrawUpdateFrame();
return;
}
if (WINDOWED)
{
GetClientRect(hwnd, &destRect);
pt.x = pt.y = 0;
ClientToScreen(hwnd, &pt);
OffsetRect(&destRect, pt.x, pt.y);
rcRect.left = 0;
rcRect.top = 0;
rcRect.right = SCRWIDTH;
rcRect.bottom = SCRHEIGHT;
}
else
{
rcRect.left = rcRect.top = 0;
rcRect.right = SCRWIDTH;
rcRect.bottom = SCRHEIGHT;
destRect = rcRect;
}
if (bSaveFramebuffer)
{
rglCopyScratchBuffer();
}
for (;;)
{
ddrval = PrimarySurface->Blt(&destRect, BackSurface, &rcRect, 0, NULL);
// ddrval = PrimarySurface->BltFast(0, 0, BackSurface, &rcRect, 0);
if (ddrval == DD_OK)
{
break;
}
if (ddrval == DDERR_SURFACELOST)
{
if (!restoreAll())
{
return;
}
}
if (ddrval != DDERR_WASSTILLDRAWING)
{
return;
}
}
}
示例11: DDFlip
HRESULT DDFlip(void)
{
#ifndef DOD_WINDOWED
HRESULT ddrval;
ddrval = lpDDSPrimary->Flip(NULL, DDFLIP_WAIT); // flip the surfaces
return ddrval;
#else
RECT rect = { 0, 0, 640, 480 };
lpDDSPrimary->Blt(&rcWindow, lpDDSBack, &rect, DDBLT_WAIT, NULL);
return 1;
#endif
}
示例12: BlitTAGameArea
void TAGameAreaReDrawer::BlitTAGameArea(LPDIRECTDRAWSURFACE DestSurf)
{
if (NULL!=GameAreaSurfaceFront_ptr)
{
if ( DD_OK!=GameAreaSurfaceFront_ptr->IsLost ( ))
{
GameAreaSurfaceFront_ptr->Restore ( );
}
// DDBLTFX ddbltfx;
// DDRAW_INIT_STRUCT(ddbltfx);
RECT GameScreen;
TAWGameAreaRect ( &GameScreen);
if(DestSurf->Blt ( &GameScreen, GameAreaSurfaceFront_ptr, NULL, DDBLT_ASYNC , NULL)!=DD_OK)
{
DestSurf->Blt ( &GameScreen, GameAreaSurfaceFront_ptr, NULL, DDBLT_WAIT , NULL);
}
}
}
示例13: __fillRect
void __fillRect(DWORD dwFillColor) {
DDBLTFX ddbltfx;
HRESULT ddrval;
memset (&ddbltfx, 0, sizeof (ddbltfx));
ddbltfx.dwSize = sizeof( ddbltfx );
#ifdef NONAMELESSUNION
ddbltfx.u5.dwFillColor = dwFillColor;
#else
ddbltfx.dwFillColor = dwFillColor;
#endif
ddrval = g_pDDSBack->Blt(NULL, NULL,
NULL, DDBLT_COLORFILL, &ddbltfx );
}
示例14: Draw_BOB
int Draw_BOB(BITMAP_OBJ_PTR bob, LPDIRECTDRAWSURFACE dest)
{
RECT dest_rect, source_rect;
dest_rect.left = bob->x;
dest_rect.top = bob->y;
dest_rect.right = bob->x + bob->width;
dest_rect.bottom = bob->y + bob->height;
source_rect.left = 0;
source_rect.top = 0;
source_rect.right = bob->width ;
source_rect.bottom = bob->height;
dest->Blt(&dest_rect, bob->image, &source_rect,
(DDBLT_WAIT | DDBLT_KEYSRC), NULL);
return 1;
}
示例15: DDFillSurface
void DDFillSurface(LPDIRECTDRAWSURFACE lpdds, WORD color)
{
DDBLTFX ddbltfx; // this contains the DDBLTFX structure
// clear out the structure and set the size field
DD_INIT_STRUCT(ddbltfx);
// set the dwfillcolor field to the desired color
ddbltfx.dwFillColor = color;
// ready to blt to surface
lpdds->Blt(NULL, // ptr to dest rectangle
NULL, // ptr to source surface, NA
NULL, // ptr to source rectangle, NA
DDBLT_COLORFILL | DDBLT_WAIT, // fill and wait
&ddbltfx); // ptr to DDBLTFX structure
}