// // AppDelegate.m // danmaku // // Created by Sam Jaffe on 5/24/19. // Copyright © 2019 Sam Jaffe. All rights reserved. // #import "AppDelegate.h" @implementation AppDelegate @synthesize gameview; NSWindowStyleMask const resizable = NSWindowStyleMaskResizable; NSWindowStyleMask const borderless = NSWindowStyleMaskBorderless; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { gameview = [[GameView alloc] initWithFrame:[[self window] frame]]; // Insert code here to initialize your application [[self window] setStyleMask:[[self window] styleMask] & ~resizable]; [[self window] setDelegate:[self gameview]]; [[self window] makeMainWindow]; } - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app { return YES; } @end @implementation GameWindow - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag { // Using NSBorderlessWindowMask results in a window without a title bar. self = [super initWithContentRect:contentRect styleMask:(aStyle | borderless) & ~resizable backing:NSBackingStoreBuffered defer:NO]; return self; } - (BOOL)canBecomeMainWindow { return YES; } - (BOOL)canBecomeKeyWindow { return YES; } @end