I am trying to use custom cursor in my game using nscursor. I use following code
//While initializing openglview
mCustomCursor = [[NSCursor alloc] initWithImage:image hotSpot:NSZeroPoint];
[image release];
[mCustomCursor开发者_开发问答 set]
I am setting cursor rect in resetcursorrect method
- (void)resetCursorRects
{
[self addCursorRect:currentViewPortRect cursor:[NSCursor currentCursor]];
}
Custom cursor appears, It is not consistent, at times it switches back to system cursor (for alerts), some times it comes back and sometime not. It is so confusing. I am not sure if I should use 'setOnMouseEntered', 'pop'. What is the standard way to use nscursor and change it dynamically.
You're changing the cursor to the current cursor, which isn't changing it at all. To display your own custom cursor, you must pass your custom cursor when creating the cursor rect.
精彩评论