Restrict mouse to an area

Get help using Construct 2

Post » Mon Jul 29, 2013 10:16 am

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!
B
10
S
4
G
2
Posts: 133
Reputation: 2,667

Post » Tue Jul 30, 2013 7:52 pm

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.
B
10
S
4
G
2
Posts: 133
Reputation: 2,667

Post » Tue Jul 30, 2013 10:30 pm

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.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Wed Jul 31, 2013 12:07 am

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!
B
10
S
4
G
2
Posts: 133
Reputation: 2,667


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 38 guests