Archived

This topic is now archived and is closed to further replies.

Taulin

Mouse Cursor - Sprite or 3DDevice Cursor?

Recommended Posts

Howdy, I have been trying to get the D3D cursor functions working, but like other people here, I have not had much luck. I looked through the old threads, but I could not find any solutions. If anyone could help, that would be great! I am doing all of the steps, and each one is not failing.. 1) I created a 32x32 image in PhotoShop for my cursor. (just a square with many bright colors). 2) I created an image buffer... hResult = lp3DDevice->CreateImageSurface( 32, 32, D3DFMT_A8R8G8B8, &m_DefulatCursorSurface); 3) Loaded it... hResult = D3DXLoadSurfaceFromFile( m_DefaultCursorSurface, NULL, NULL, FileName, NULL, D3DX_DEFAULT, 0xFF000000, NULL ); 4) And Set the Cursor Properties hResult = lp3DDevice->SetCursorProperties( 1, 1, m_DefaultCursorSurface ); 5) Each time I render the screen, I call : lp3DDevice->SetCursorPosition( X, Y, D3DCURSOR_IMMEDIATE_UPDATE); lp3DDevice->ShowCursor( TRUE ); All of my other graphics are rendering OK, but my cursor is no where in sight. Has anyone else had this trouble? Or should I just use a D3DXSprite? Thanks for any help or suggestions, I am at the "bang your head against the wall" stage now.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I wouldn''t recommend using the cursor interface, it doesn''t seem to work on far too many ocasions (I bet MS doesn''t know why). If you want to make a sprite, then it will work, but, seeing that you''ve already got the surface then you might want to do a simply copysurface (or copyrect, I don''t remember what''s the name of the function) with your mouse position, which you might set according to the mouse movement or just acquire it from Windows (see the pick example to see how you acquire the exact screen position).

Share this post


Link to post
Share on other sites
I can remember that there was a good tutorial on www.directx4vb.com . Let me take a look ... no sorry, it uses sprites too. But thanks for the info that this part of DirectX8 won''t work.

Share this post


Link to post
Share on other sites
I am starting to agree using the Cusor functionality is not the best way. I am just wondering how much overhead using the Cursor functions help.

If I start calling bitblit, I will have to lock the surfaces. I wonder if DX is doing that anyway when it updates its DX cursor.

Using a textured quad will require me to chache another texture.

However, in the end I would like an animated cursor which does not seem possible using the DX Cursor routines, but I would like to try and get them working anyway.

Any possibility my BMP could be the wrong format? In PS and Paint, I can only select a 24bit format. Is there another selection to make sure it saves the alpha also?

Again thanks for the help and suggestions.

Share this post


Link to post
Share on other sites