ok i have the following code
D3DXCreateSprite(d3ddev, &d3dspt); // create the Direct3D Sprite object
D3DXCreateTextureFromFileEx(d3ddev,"MousePtr.bmp",D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,NULL,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,D3DCOLOR_XRGB(0, 255, 0),NULL,NULL,&cursor);
D3DXCreateTextureFromFileEx(d3ddev,"background.png",D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,NULL,D3DFMT_A8R8G8B8,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,D3DCOLOR_XRGB(0, 255, 0),NULL,NULL,&background);
void DrawMouse()
{
POINT cur;
GetCursorPos(&cur);
RECT part;
static int frame;
if(frame < 20) frame ++;
if(frame >= 20) frame = 0;
xpos = frame * 51;
part.left = xpos + 1;
part.right = part.left + 51 + 1;
part.top = 0;
part.bottom = 33;
d3dspt->Begin(D3DXSPRITE_ALPHABLEND);
D3DXVECTOR3 center(0.0f,0.0f,0.0f);
D3DXVECTOR3 position((float)cur.x,(float)cur.y,0.0f);
d3dspt->Draw(cursor, &part, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));
d3dspt->End();
}
void DrawBackground()
{
d3dspt->Begin(D3DXSPRITE_ALPHABLEND);
D3DXVECTOR3 center(0.0f,0.0f,0.0f);
D3DXVECTOR3 position(0.0f,0.0f,0.0f);
d3dspt->Draw(background, NULL, ¢er, &position, D3DCOLOR_ARGB(255, 255, 255, 255));
d3dspt->End();
}
and i am using 2 images for this
cursor: 760x27 px
background: 1024x768 px
and the 1st problem
1)My sprites for the cursor are 38 px apart, but it will only work fine when i use 51px as shown in the
DrawMouse function
2)My background isnt drawn completely, like some parts are off the screen, my images are all power 2, why does that still happen
3)My cursor (the rendered sprite) also isn't accurate, at 0,0 it correpsonds with the real cursor, but at the bottom, well lets just say, that rendered cursor cant reach the bottom
Thanks