3

游戏全屏时如何遮挡热点?当系统中启用了热角并且游戏处于全屏状态时,当我将光标移动到任何角落时,游戏被最小化。

我像这样更改为全屏:

fullscreenWindow = [[NSWindowFullscreen alloc] initWithContentRect:frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer: NO];
mainWindow = [self window];
[mainWindow setAcceptsMouseMovedEvents:NO];
[mainWindow orderOut:nil];

// Set the options for our new fullscreen window     
[fullscreenWindow setReleasedWhenClosed: YES];
[fullscreenWindow setLevel: NSFloatingWindowLevel];
[fullscreenWindow setHidesOnDeactivate:YES];            
[fullscreenWindow setContentView: self];
[fullscreenWindow makeKeyAndOrderFront:self];    
[fullscreenWindow makeFirstResponder:self];         
[fullscreenWindow setAcceptsMouseMovedEvents:YES];
4

2 回答 2

2

当鼠标位置在顶部时,您可以更改的鼠标位置。

- (void)mouseMoved:(NSEvent *)theEvent
    {
        NSPoint mouseLoc;
        mouseLoc = [NSEvent mouseLocation]; //get current mouse position
        //mouse position change
        CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
        int Height = (int)ScrnRect.size.height;
       // NSLog(@"Height::%d,MouSe.Y::%f",Height,mouseLoc.y);
        if(Height < mouseLoc.y+5 ){
            CGEventRef mouse = CGEventCreateMouseEvent (NULL, kCGEventMouseMoved, CGPointMake( mouseLoc.x, 5), 0);
            CGEventPost(kCGHIDEventTap, mouse);
            CFRelease(mouse);
            CFRelease(source);
        }
    }
于 2016-04-29T04:51:31.367 回答
0

在setLevel中尝试更高级别: 您不仅限于 NSWindow 类参考中的级别。这些只是#define 为 Quartz/Core Graphics 中的一部分命名的其他名称。在常量中查看它们 https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html

于 2013-01-05T02:18:26.963 回答