Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct CURSORVERTEX
- {
- FLOAT x, y, z, w; // The transformed position for the vertex
- DWORD dwColor; // Color
- };
- #define D3DFVF_CURSORVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
- #define CURSOR_SIZE 60.0f
- // Device for rendering the real-time objects like cursors
- IDirect3DDevice9Ex* g_pDevRealTime = NULL;
- // cursor vertex buffer
- IDirect3DVertexBuffer9* g_pCursorVB = NULL;
- void MoveCursor( UINT posX, UINT posY )
- {
- float x = static_cast<float>(posX);
- float y = static_cast<float>(posY);
- // Initialize vertices for rendering a quad
- CURSORVERTEX vertices[4];
- vertices[0].x = x;
- vertices[0].y = y;
- vertices[0].z = 0.5f;
- vertices[0].w = 1.0f;
- vertices[1].x = x + CURSOR_SIZE;
- vertices[1].y = y + CURSOR_SIZE*0.6f;
- vertices[1].z = 0.5f;
- vertices[1].w = 1.0f;
- vertices[2].x = x + CURSOR_SIZE*0.6f;
- vertices[2].y = y + CURSOR_SIZE;
- vertices[2].z = 0.5f;
- vertices[2].w = 1.0f;
- vertices[3].x = x + CURSOR_SIZE;
- vertices[3].y = y + CURSOR_SIZE;
- vertices[3].z = 0.5f;
- vertices[3].w = 1.0f;
- for(int i=0; i<4; i++)
- vertices[i].dwColor = 0xff0000;
- VOID* pVertices;
- if( FAILED( g_pCursorVB->Lock( 0, sizeof(vertices), (void**)&pVertices, 0 ) ) )
- return;
- memcpy( pVertices, vertices, sizeof(vertices) );
- g_pCursorVB->Unlock();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement