I’d like to have the cursor be hidden when it’s moved inside the window’s bounds, and reappear when its is moved outside. (Similar to the old Mac function ShieldCursor() )
However, it seems I only get mouse-moved events while the cursor is moved within the window’s bounds, so there is no way of knowing when it has moved outside the window. Is this the case, or am I missing something?
This is for SDL 1.3.
Okay, so I discovered: SDL_WINDOWEVENT_ENTER and SDL_WINDOWEVENT_LEAVE. Which in theory, according to the Wiki docs, should provide what I’m looking for. But with a simple test program, I get mouse enter/leave events every single time I move the cursor. It just spams the window with output when I move the mouse. This is on MacOS X. Is this a bug on this platform?
Can anyone test these events on Windows, and see if they work as expected? (i.e. only a single event when the mouse moves outside the window, and a single event when it comes back inside.)
void MyHandleSDLEvent(SDL_Event * event, int *done)
{
switch (event->type)
{
case SDL_WINDOWEVENT:
switch (event->window.event)
{
case SDL_WINDOWEVENT_CLOSE:
*done = 1;
break;
case SDL_WINDOWEVENT_ENTER:
printf("Mouse entered our window! windowID = %d \n", event->window.windowID);
break;
case SDL_WINDOWEVENT_LEAVE:
printf("Mouuse left the window! windowID = %d \n", event->window.windowID);
break;
}
break;
[SNIP]
-Vern