MouseDevice.GetForCurrentView().MouseMoved event leads to loosing fps in game RRS feed

  • Question

  • Hello,

    I am using MouseDevice.GetForCurrentView().MouseMoved event to get raw Delta from mouse to have no bounds for camera moving.

    I subscribe to this event only once in constructor like this:

    class MouseInput
            private MouseManager mouseManager;
            public MouseManager MouseManager
                get { return mouseManager; }
                set { mouseManager = value; }
            public float DeltaX { get; set; }
            public float DeltaY { get; set; }
            public MouseState MouseState
                    return mouseManager.GetState(); 
            public MouseInput(Game game)
                // Create the mouse manager
                mouseManager = new MouseManager(game);
             MouseDevice.GetForCurrentView().MouseMoved += (sender, args) =>
                DeltaX = args.MouseDelta.X;
                DeltaY = args.MouseDelta.Y;

    First everything seems OK, but more I move mouse, the more fps starting to drop down. and when I start moving mouse in game, fps goes from 60 to 10-15.

    I use debug mode a lot and I noticed that more debugs I start, more hangs will appear. And after this even system begin to hang sometimes.

    So, I wish to know am I doing something wrong here? Need I unsubscribe from this even when exit or something else? Why using this event in game leads to fps loosing?

    Friday, December 19, 2014 11:48 AM