Restrict mouse to an area

  • Is it possible to restrict the mouse to a certain area or within boarders for example if I make a game that always runs in a tiny window can I lock the mouse to that window?

    I know I can restrict movement of my objects but I really need to force the mouse to only one area while the games levels run.

    Thanks!

  • Well I have not found a complete solution to my problem yet.

    I have worked around the issue by setting the Mouse to None when it crosses over areas that I want to display cleanly.

    :) Always more than one way to accomplish something similar/acceptable.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can't lock mouse in absolute position. Except there a API about Pointer Lock would stay at center of window.

    I suggested that to Ashley, then he is not interesed.

    Someone could develop a plugin with Pointer Lock API for C2.

  • Just in case anyone reads this I will explain why it would be useful in my situation...

    My project is built for a Desktop with two monitors... one monitor is only for displaying information so being able to lock the mouse to the first monitor would be an advantage for not losing the mouse!

    Even if we could set the X, Y of the mouse that would give us the ability to create our own mouse lock-down! Or jump the mouse to the X, Y of an object would do much the same... some kind of control over cursor position!

    Thanks for the reply!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)