Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jmp

Pages: [1]
1
Feature requests / Mouse capture/grab
« on: January 06, 2011, 03:27:40 pm »
Quote from: "Walker"
window.SetCursorPosition(halfScreenWidth, halfScreenHeight);

Unfortunately that isn't sufficient because the user can still move the mouse outside the window. What's even worse, if the user clicks when the mouse is outside the window, the SFML window loses focus.

Quote from: "Zweistein"
Can anybody post a workaround until we get it?

SFML 2* and Windows only:

Get the HWND of the SFML window with sf::Window::GetSystemHandle.
Get the window area coordinates to a RECT with GetClientRect.
Translate the window coordinates to screen coordinates with ClientToScreen.
Supply those coordinates to ClipCursor. That limits the the mouse movement to the window area.

For sample code (and how to do it on X11 / OSX), you could check how SDL does it.

To ungrab mouse, just call ClipCursor(NULL).

*SFML 1.x has no sf::Window::GetSystemHandle, so you would need to get the HWND some other way.

2
Feature requests / Mouse capture/grab
« on: January 06, 2011, 02:36:44 pm »
I would also like to see this feature.  It's pretty much essential for any program that implements mouse look.

3
Feature requests / Disable SFML Console Outputting
« on: February 08, 2010, 01:34:05 pm »
Quote from: "Laurent"
SFML outputs to std::cerr, and any standard stream can be redirected to whatever you want: a file, nothing, etc.

Would it make sense for SFML should write its errors to its own error stream rather than std::cerr in the future?  The problem with redirecting std::cerr is that it also redirects everything else sent to that stream (e.g. the errors my program prints, or really anything that uses std::cerr) even if I only want to redirect SFML’s errors.

Anyway, just a suggestion.

Pages: [1]