Ok, I decided to get a little into directx again, and I decided to use direct3d for 2d graphics (rather than use direcdraw).
I managed to get things to display just fine with transparency until I went to make a small cursor (17x17 pixels). It looks fine, except there's a square around it! I thought maybe photoshop was playing tricks on me and somehow I had changed the red by 1 or something around the edge. Nope, its the right color (magenta).
So I try to make the image larger and draw something around the outside. Run the program again, cursor looks the same! Hmm, maybe I saved under the wrong name. But I try to draw inside the square and when I run the program again, the inside of the square has changed, but nothing outside has changed!
Here's how I load the texture:
And I use a D3DXSprite to display it:Code:bool object::LoadTexture(char *fileName, LPDIRECT3DDEVICE9 d3dDevice) { //Use a magenta colourkey D3DCOLOR colorkey = 0xFFFF00FF; // Load image from file if (FAILED(D3DXCreateTextureFromFileEx (d3dDevice, fileName, 0, 0, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT, colorkey, NULL, NULL, &texture))) { return false; } D3DSURFACE_DESC surfaceDesc; texture->GetLevelDesc(0, &surfaceDesc); width = surfaceDesc.Width; height = surfaceDesc.Height; return true; }
I'll also attach images of what my cursor looks like in photoshop then in the program.Code:Sprite->Draw(texture,NULL,NULL,&D3DXVECTOR2(width/2,height/2),rot,&D3DXVECTOR2(x,y),0xFFFFFFFF);



LinkBack URL
About LinkBacks



)