Cocoaアプリケーションでフルスクリーンを実現する方法です。
- (void)awakeFromNib
{
unsigned int window_style;
NSRect screen_rect;
window_style = NSBorderlessWindowMask;
screen_rect = [[NSScreen mainScreen] frame];
fullscreen_window = [[NSWindow alloc] initWithContentRect:screen_rect styleMask:window_style backing:NSBackingStoreBuffered defer:NO];
if(fullscreen_window != nil)
{
[fullscreen_window setReleasedWhenClosed:YES];
[fullscreen_window setContentView:self];
[fullscreen_window makeKeyAndOrderFront:self];
[fullscreen_window setLevel:NSScreenSaverWindowLevel - 1];
[fullscreen_window makeFirstResponder:self];
}
[NSCursor hide];
NSOpenGLViewから派生したクラスのawakeFromNibに上記のコードを追加するだけ。 解像度はWindowsのDirectXと違い画面の解像度そのままでフルスクリーン化されるので注意が必要です。 [NSCursor hide]はカーソルを消す命令です。
前に戻る?