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


C++ LPDIRECT3DDEVICE9::SetCursorProperties方法代码示例

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


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

示例1: SetAsHardwareCursor

void Texture::SetAsHardwareCursor(const Vector2 & hotSpot)
{
    if (id)
    {
        LPDIRECT3DSURFACE9 textureMainSurface;
        HRESULT hr = id->GetSurfaceLevel(0, &textureMainSurface);
        RENDER_VERIFY(hr);

        // Check surface format

        //
        D3DSURFACE_DESC desc;
        ZeroMemory(&desc, sizeof(desc));
        RENDER_VERIFY(textureMainSurface->GetDesc(&desc));

        LPDIRECT3DDEVICE9 device = RenderManager::Instance()->GetD3DDevice();
        hr = device->SetCursorProperties((UINT)hotSpot.x, (UINT)hotSpot.y, textureMainSurface);
        RENDER_VERIFY(hr);
        D3DSafeRelease(textureMainSurface);
    }
}
开发者ID:galek,项目名称:dava.framework,代码行数:21,代码来源:TextureDX9.cpp

示例2:

HRESULT HookIDirect3DDevice9::SetCursorProperties(LPVOID _this, UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap)
{
	LOG_API();
	return pD3Dev->SetCursorProperties(XHotSpot, YHotSpot, pCursorBitmap);
}
开发者ID:zxmarcos,项目名称:bg4t_monitor,代码行数:5,代码来源:D3DWrapper.cpp

示例3: D3DUtil_SetDeviceCursor


//.........这里部分代码省略.........
    bmi.bmiHeader.biCompression = BI_RGB;

    hdcScreen = GetDC( NULL );
    hdcMask = CreateCompatibleDC( hdcScreen );
    if( hdcMask == NULL )
    {
        hr = E_FAIL;
        goto End;
    }
    hgdiobjOld = SelectObject(hdcMask, iconinfo.hbmMask);
    GetDIBits(hdcMask, iconinfo.hbmMask, 0, dwHeightSrc, 
        pcrArrayMask, &bmi, DIB_RGB_COLORS);
    SelectObject(hdcMask, hgdiobjOld);

    if (!bBWCursor)
    {
        pcrArrayColor = new DWORD[dwWidth * dwHeightDest];
        hdcColor = CreateCompatibleDC( hdcScreen );
        if( hdcColor == NULL )
        {
            hr = E_FAIL;
            goto End;
        }
        SelectObject(hdcColor, iconinfo.hbmColor);
        GetDIBits(hdcColor, iconinfo.hbmColor, 0, dwHeightDest, 
            pcrArrayColor, &bmi, DIB_RGB_COLORS);
    }

    // Transfer cursor image into the surface
    D3DLOCKED_RECT lr;
    pCursorSurface->LockRect( &lr, NULL, 0 );
    pBitmap = (DWORD*)lr.pBits;
    for( y = 0; y < dwHeightDest; y++ )
    {
        for( x = 0; x < dwWidth; x++ )
        {
            if (bBWCursor)
            {
                crColor = pcrArrayMask[dwWidth*(dwHeightDest-1-y) + x];
                crMask = pcrArrayMask[dwWidth*(dwHeightSrc-1-y) + x];
            }
            else
            {
                crColor = pcrArrayColor[dwWidth*(dwHeightDest-1-y) + x];
                crMask = pcrArrayMask[dwWidth*(dwHeightDest-1-y) + x];
            }
            if (crMask == 0)
                pBitmap[dwWidth*y + x] = 0xff000000 | crColor;
            else
                pBitmap[dwWidth*y + x] = 0x00000000;

            // It may be helpful to make the D3D cursor look slightly 
            // different from the Windows cursor so you can distinguish 
            // between the two when developing/testing code.  When
            // bAddWatermark is TRUE, the following code adds some
            // small grey "D3D" characters to the upper-left corner of
            // the D3D cursor image.
            if( bAddWatermark && x < 12 && y < 5 )
            {
                // 11.. 11.. 11.. .... CCC0
                // 1.1. ..1. 1.1. .... A2A0
                // 1.1. .1.. 1.1. .... A4A0
                // 1.1. ..1. 1.1. .... A2A0
                // 11.. 11.. 11.. .... CCC0

                const WORD wMask[5] = { 0xccc0, 0xa2a0, 0xa4a0, 0xa2a0, 0xccc0 };
                if( wMask[y] & (1 << (15 - x)) )
                {
                    pBitmap[dwWidth*y + x] |= 0xff808080;
                }
            }
        }
    }
    pCursorSurface->UnlockRect();

    // Set the device cursor
    if( FAILED( hr = pd3dDevice->SetCursorProperties( iconinfo.xHotspot, 
        iconinfo.yHotspot, pCursorSurface ) ) )
    {
        goto End;
    }

    hr = S_OK;

End:
    if( iconinfo.hbmMask != NULL )
        DeleteObject( iconinfo.hbmMask );
    if( iconinfo.hbmColor != NULL )
        DeleteObject( iconinfo.hbmColor );
    if( hdcScreen != NULL )
        ReleaseDC( NULL, hdcScreen );
    if( hdcColor != NULL )
        DeleteDC( hdcColor );
    if( hdcMask != NULL )
        DeleteDC( hdcMask );
    SAFE_DELETE_ARRAY( pcrArrayColor );
    SAFE_DELETE_ARRAY( pcrArrayMask );
    SAFE_RELEASE( pCursorSurface );
    return hr;
}
开发者ID:arkiny,项目名称:Direct3D,代码行数:101,代码来源:d3dutil.cpp


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