hiding the cursor

Member
Posts: 194
Joined: 2009.02
Post: #1
So I have a window with a custom view, while the mouse is within this window I want to hide it and draw my own cursor image, then show it once the mouse leaves the game window.

So I added this to my main loop.

Code:
if ( is_point_in_game_window( mymouse))
     [NSCursor hide];
else
     [NSCursor unhide];

The problem is that once I move the mouse out of the window, there's a huge delay before it's unhidden. I believe, but am not sure, that this is because "mymouse" is updated through the view's mouseMoved event. If this is the case, then is there a way to read the position of the mouse every frame instead of waiting for a mouseMoved event to fire? And if not then what might be the cause?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
the solution I've used to this is to define a mouse tracking region that fills the view, and listen to the mouseEntered/mouseExited events.
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2010.08
Post: #3
Hmm good...i was thnking about this kind of code that how we can hide the cursor in the game while playing but i didn't understand one thing that is this code in Java?....colon cleanse reviews
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
It's Objective-C.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Post Reply