Suppressing (hiding) and locking a Mouse Cursor in Metro-style games/apps RRS feed

  • Question

  • The game upon which I work has an avatar that flies around in 2D space (Left/Right, Up/Down).

    The avatar has a reticle used for directional aiming (not precise aiming) that can be rotated circularly 360 degrees.

    There, unfortunately, is also a visible mouse-cursor on the screen, which moves freely about per user-input without any boundaries at all.

    It's an action game, so the end-user is moving the mouse around frequently to aim and clicking rapidly to shoot.

    The result of this is that the end-user can & will accidentally grip the edge of the screen with the mouse cursor unintentionally and also "drag" the game screen, either losing their focus on the game, accidentally pausing the game, or both.

    Did I mention this happens frequently?

    What is need is a way to (any of the below or other will do)

    1) suppress the mouse cursor entirely (visibly and its ability to affect the edges of the screen)

    2) "lock" the mouse cursor to the avatar's reticle (note that "avatar is used in the classical game sense, not the Xbox LIVE avatar sense)

    3) some nifty combination of the above or a suggestion that I haven't come up with myself?

    Thank you for your time & attention.


    Tuesday, May 22, 2012 6:05 PM

All replies

  • I think you should fix the camera, so that the mouse cursor will be fixed.


    Thursday, May 24, 2012 2:27 AM
  • My only help is that this is how you did it on XP/DX9

    SetCursor( NULL );  // turn off HW curson

    m_d3dDevice->ShowCursor( TRUE ); // turn on D3D cursor

    Sorry if that does not help...


    Friday, May 25, 2012 5:06 AM
  • I am very thankful for the response, Luke-Skywalker!  Unfortunately, it's not a camera issue.  But the response is very much appreciated!
    Saturday, May 26, 2012 12:31 AM
  • I appreciate your suggestion, David - I will reply after informing the developer and seeing what they think.
    Saturday, May 26, 2012 12:32 AM
  • Hi David,

    Thanks for the answer. Unfortunately this doesn't work on Metro. It is possible to hide/change the cursor using CoreWindow's PointerCursor property, but we can't seem to lock it to a set position, or at least prevent it from leaving the window.


    David Goemans

    Tuesday, May 29, 2012 9:09 AM
  • Windows 8 Release Preview has some improvements here.


    • Proposed as answer by muadib Monday, July 9, 2012 1:29 PM
    Monday, June 4, 2012 5:49 PM