Dipucian Posted August 24, 2004 Posted August 24, 2004 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); } Quote
*Experts* mutant Posted August 24, 2004 *Experts* Posted August 24, 2004 How about using the SetCursor method? You can pass in a Cursor object to it. Quote
Dipucian Posted August 25, 2004 Author Posted August 25, 2004 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... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.