x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

[Closed] How can I capture the mouse in window mode?

Hi!

How can I capture the mouse such that it can't leave the window as long as it's active/focused? Also is this possible to achieve in the editor as well?

Product Version: Not Selected
Tags:
more ▼

asked Apr 28 '14 at 08:08 PM in C++ Programming

avatar image

undercover
843 123 111 138

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Sep 19 '14 at 04:49 PM by undercover for the following reason:

Problem is not reproducible or outdated


1 answer: sort voted first

All things related to window and input you can find in FViewport

https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/FViewport/index.html

And there you can find things like that :) :

https://docs.unrealengine.com/latest/INT/API/RuntimeModules/Engine/FViewport/LockMouseToViewport/index.html

To get instace of your viewport from:

GEngine->GameViewport

more ▼

answered Apr 28 '14 at 08:17 PM

avatar image

Shadowriver
36.6k 930 169 1111

avatar image undercover Apr 29 '14 at 10:58 AM

It really looks like that would solve it. However when I try, it has no effect. I guess I will have to search through the StrategyGame example. It looks like they have used Slate in some way to prevent that the mouse leaves the window but am not quite sure yet.

avatar image James Ordner Jun 14 '14 at 11:17 PM

I'm also in the same boat. I've used that function, and nothing changes. The mouse is still free to leave the window. Not a good thing, as the player is supposed to move the camera by moving the cursor to the edge of the screen.

Edit: After reading through this post, I've found that mouse locking works only after going fullscreen with alt + enter. After going fullscreen, the mouse is still locked even after leaving fullscreen. Why wouldn't it just work on launch?

avatar image undercover Jun 15 '14 at 04:04 PM

I think I will submit this as a bug since either the name of the method is incorrect or the method isn't working. Thanks for letting me know.

avatar image undercover Jun 15 '14 at 04:15 PM

I added a bug report here link. Hope we can get some help with this.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question