AppDelegate.m 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // AppDelegate.m
  3. // danmaku
  4. //
  5. // Created by Sam Jaffe on 5/24/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #import "AppDelegate.h"
  9. @implementation AppDelegate
  10. @synthesize gameview;
  11. NSWindowStyleMask const resizable = NSWindowStyleMaskResizable;
  12. NSWindowStyleMask const borderless = NSWindowStyleMaskBorderless;
  13. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
  14. {
  15. gameview = [[GameView alloc] initWithFrame:[[self window] frame]];
  16. // Insert code here to initialize your application
  17. [[self window] setStyleMask:[[self window] styleMask] & ~resizable];
  18. [[self window] setDelegate:[self gameview]];
  19. [[self window] makeMainWindow];
  20. }
  21. @end
  22. @implementation GameWindow
  23. - (id)initWithContentRect:(NSRect)contentRect
  24. styleMask:(NSWindowStyleMask)aStyle
  25. backing:(NSBackingStoreType)bufferingType
  26. defer:(BOOL)flag {
  27. // Using NSBorderlessWindowMask results in a window without a title bar.
  28. self = [super initWithContentRect:contentRect
  29. styleMask:(aStyle | borderless) & ~resizable
  30. backing:NSBackingStoreBuffered
  31. defer:NO];
  32. return self;
  33. }
  34. - (BOOL)canBecomeMainWindow {
  35. return YES;
  36. }
  37. - (BOOL)canBecomeKeyWindow {
  38. return YES;
  39. }
  40. @end