我正在尝试使用 nscursor 在游戏中使用自定义光标。我使用以下代码
//While initializing openglview
mCustomCursor = [[NSCursor alloc] initWithImage:image hotSpot:NSZeroPoint];
[image release];
[mCustomCursor set]
我正在resetcursorrect方法中设置光标矩形
- (void)resetCursorRects
{
[self addCursorRect:currentViewPortRect cursor:[NSCursor currentCursor]];
}
出现自定义光标,它不一致,有时会切换回系统光标(用于警报),有时会返回,有时不会。这太令人困惑了。我不确定是否应该使用“setOnMouseEntered”、“pop”。使用 nscursor 并动态更改它的标准方法是什么。
最佳答案
您正在将光标更改为当前光标,而当前光标根本没有改变。要显示您自己的自定义光标,您必须在创建光标矩形时传递您的自定义光标。
关于macos - 如何使用 NSCursor 显示自定义光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7608733/