2

我正在尝试使用 nscursor 在我的游戏中使用自定义光标。我使用以下代码


//While initializing openglview 
    mCustomCursor = [[NSCursor alloc] initWithImage:image hotSpot:NSZeroPoint];
    [image release];
[mCustomCursor set]

我在 resetcursorrect 方法中设置光标 rect


- (void)resetCursorRects
{

    [self  addCursorRect:currentViewPortRect cursor:[NSCursor currentCursor]];

}

出现自定义光标,不一致,有时会切换回系统光标(用于警报),有时会返回,有时不会。这太令人困惑了。我不确定是否应该使用“setOnMouseEntered”、“pop”。使用 nscursor 并动态更改它的标准方法是什么。

4

1 回答 1

3

您正在将光标更改为当前光标,而根本没有更改它。要显示您自己的自定义光标,您必须在创建光标矩形时传递您的自定义光标。

于 2011-09-30T12:14:55.377 回答