• Advertisement
Sign in to follow this  

[SlimDX]Device.SetCursorPos()

This topic is 3450 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am fooling around with the Device class and I noticed the function SetCursor(). I figured it would put my mouse wherever I wanted when I called it. However, my mouse stays in the same place, what is wrong? It doesn't work in full screen either.

namespace D3DExperiment
{
    
    class BZWindow : Form
    {
        
        Device device;
        Direct3D d3d;

        private void CreateDevice()
        {

            d3d = new Direct3D ();

            PresentParameters presentParams = new PresentParameters();
            presentParams.Windowed = true;
            presentParams.SwapEffect = SwapEffect.Flip;
            presentParams.DeviceWindowHandle = this.Handle;


            device = new Device ( d3d , 0, DeviceType.Reference, this.Handle , CreateFlags.SoftwareVertexProcessing ,presentParams );
            
        }

        public BZWindow()
        {
            //this.WindowState = FormWindowState.Maximized;
            //this.FormBorderStyle = FormBorderStyle.None;
        }
        

        protected override void OnPaint(PaintEventArgs e)
        {
            device.BeginScene ();
                                                                    //zdepth and stencil
            device.Clear ( ClearFlags.Target, new Color4(Color.Red) , 1 , 0 );
            device.SetCursorPosition ( new Point ( 100, 100 ), false );

            device.EndScene ();
            device.Present ();
        }

        static void Main()
        {
            using (BZWindow window = new BZWindow())
            {
                window.CreateDevice ();
                Application.Run ( window );
            }
        }
    }
}




Share this post


Link to post
Share on other sites
Advertisement
You can't really use the D3D9 cursor methods in isolation. See here. They're for using a surface as a cursor, mainly; if all you want to do is move your existing cursor, there are better ways (the ones provided by the OS/framework, not be D3D/SlimDX).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement