Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all! My first post herehttp://www.xtremedotnettalk.com/images/smilies/tongue.gif

 

I want to make a custom cursor for my game, I searched the msdn and found three functions which I think will make it happen. But I failed...http://www.xtremedotnettalk.com/images/smilies/redface.gif

 

The three functions are SetCursorProperties, ShowCursor and SetCursorPosition of the Direct3D Device class. Experts here please help...

 

My code are as follows:

 
public void Init()
{
PresentParameters presParameters = new PresentParameters();
presParameters.BackBufferCount = 1;
presParameters.Windowed = true;
presParameters.SwapEffect = SwapEffect.Discard;
graphicCard = new Device(0, DeviceType.Hardware, target,
CreateFlags.HardwareVertexProcessing,
presParameters);
System.Drawing.Bitmap bm = new System.Drawing.Bitmap(@"..\..\head.gif");
Surface s = Surface.FromBitmap(graphicCard, bm, Pool.SystemMemory);
graphicCard.SetCursorProperties(0, 0, s);
graphicCard.ShowCursor(true);
graphicCard.SetCursorPosition(0, 0, true);
} 

Posted

Thanks for your help!

But I have tried to change my code (last 5 lines) to:

Cursor c = new Cursor(@"..\..\head.gif");
graphicCard.SetCursor(c, true);

and it said the function only takes .cur files, how to get one from .gif?

I've tried the public Cursor(Type, string); overload, but don't work also...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...