- 追加された行はこの色です。
- 削除された行はこの色です。
*Cocoaでフルスクリーンモード [#rc50d9a6]
Cocoaアプリケーションでフルスクリーンを実現する方法です。
**プログラム [#m6234ec5]
- (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]はカーソルを消す命令です。
[[前に戻る>多機種対応プログラミング]]