[SlimDX]Device.SetCursorPos()

Started by
0 comments, last by jpetrie 15 years, 7 months ago
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 );
            }
        }
    }
}




J.W.
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).

This topic is closed to new replies.

Advertisement