Bläddra i källkod

Update macOS implementation

Add styleMasks for window parameters.
master
TheoryOfNekomata 1 år sedan
förälder
incheckning
013d3a3ff1
3 ändrade filer med 13 tillägg och 3 borttagningar
  1. +1
    -1
      .gitignore
  2. Binär
      cerberus.xcodeproj/project.xcworkspace/xcuserdata/theoryofnekomata.xcuserdatad/UserInterfaceState.xcuserstate
  3. +12
    -2
      src/main.m

+ 1
- 1
.gitignore Visa fil

@@ -1,3 +1,3 @@
.idea/
cmake-build-debug/
.DS_Store
.DS_Store

Binär
cerberus.xcodeproj/project.xcworkspace/xcuserdata/theoryofnekomata.xcuserdatad/UserInterfaceState.xcuserstate Visa fil


+ 12
- 2
src/main.m Visa fil

@@ -1,14 +1,24 @@
#import <Cocoa/Cocoa.h>
#import "main.h"


int main() {
// https://stackoverflow.com/questions/30269329/creating-window-application-in-pure-c-on-mac-osx
@autoreleasepool {
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
id applicationName = [[NSProcessInfo processInfo] processName];
id window = [[NSWindow alloc] initWithContentRect:NSMakeRect(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT)
styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreBuffered defer:NO];
id window = [
[NSWindow alloc]
initWithContentRect: NSMakeRect(WINDOW_X, WINDOW_Y, WINDOW_WIDTH, WINDOW_HEIGHT)
styleMask:
NSWindowStyleMaskTitled
| NSWindowStyleMaskClosable
| NSWindowStyleMaskMiniaturizable
| NSWindowStyleMaskResizable
backing:NSBackingStoreBuffered
defer:NO
];
[window cascadeTopLeftFromPoint:NSMakePoint(20, 20)];
[window setTitle:applicationName];
[window makeKeyAndOrderFront:nil];


Laddar…
Avbryt
Spara