Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.68 KB | None | 0 0
  1. #import <Cocoa/Cocoa.h>
  2. #import <OpenGL/gl.h>
  3. #import <OpenGL/glu.h>
  4. #include "3rdparty/imgui/imgui.h"
  5.  
  6. #define WINDOW_W 640
  7. #define WINDOW_H 480
  8.  
  9. #define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
  10.  
  11. static struct imgui_values_t {
  12. float dpi_scale;
  13. bool m_pressed[2];
  14. float m_coords[2];
  15. unsigned int win_w, win_h, back_w, back_h;
  16. clock_t last_clock;
  17. } vals = {
  18. .dpi_scale = 1.f,
  19. .m_pressed = { false, false },
  20. .m_coords = { 0, 0 },
  21. .win_w = WINDOW_W,
  22. .win_h = WINDOW_H,
  23. .back_w = 0,
  24. .back_h = 0
  25. };
  26.  
  27. static bool map_keys(int* keymap) {
  28. if (*keymap == NSUpArrowFunctionKey)
  29. *keymap = ImGuiKey_LeftArrow;
  30. else if (*keymap == NSDownArrowFunctionKey)
  31. *keymap = ImGuiKey_DownArrow;
  32. else if (*keymap == NSLeftArrowFunctionKey)
  33. *keymap = ImGuiKey_LeftArrow;
  34. else if (*keymap == NSRightArrowFunctionKey)
  35. *keymap = ImGuiKey_RightArrow;
  36. else if (*keymap == NSHomeFunctionKey)
  37. *keymap = ImGuiKey_Home;
  38. else if (*keymap == NSEndFunctionKey)
  39. *keymap = ImGuiKey_End;
  40. else if (*keymap == NSDeleteFunctionKey)
  41. *keymap = ImGuiKey_Delete;
  42. else if (*keymap == 25) // SHIFT + TAB
  43. *keymap = 9; // TAB
  44. else
  45. return true;
  46.  
  47. return false;
  48. }
  49.  
  50. static void reset_keys() {
  51. ImGuiIO& io = ImGui::GetIO();
  52. io.KeysDown[io.KeyMap[ImGuiKey_A]] = false;
  53. io.KeysDown[io.KeyMap[ImGuiKey_C]] = false;
  54. io.KeysDown[io.KeyMap[ImGuiKey_V]] = false;
  55. io.KeysDown[io.KeyMap[ImGuiKey_X]] = false;
  56. io.KeysDown[io.KeyMap[ImGuiKey_Y]] = false;
  57. io.KeysDown[io.KeyMap[ImGuiKey_Z]] = false;
  58. io.KeysDown[io.KeyMap[ImGuiKey_LeftArrow]] = false;
  59. io.KeysDown[io.KeyMap[ImGuiKey_RightArrow]] = false;
  60. io.KeysDown[io.KeyMap[ImGuiKey_Tab]] = false;
  61. io.KeysDown[io.KeyMap[ImGuiKey_UpArrow]] = false;
  62. io.KeysDown[io.KeyMap[ImGuiKey_DownArrow]] = false;
  63. io.KeysDown[io.KeyMap[ImGuiKey_Tab]] = false;
  64. }
  65.  
  66. static void ImImpl_RenderDrawLists(ImDrawData* draw_data) {
  67. ImGuiIO& io = ImGui::GetIO();
  68. int fb_width = (int)(draw_data->DisplaySize.x * io.DisplayFramebufferScale.x);
  69. int fb_height = (int)(draw_data->DisplaySize.y * io.DisplayFramebufferScale.y);
  70. if (fb_width == 0 || fb_height == 0)
  71. return;
  72. draw_data->ScaleClipRects(io.DisplayFramebufferScale);
  73.  
  74. GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
  75. GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
  76. GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
  77. GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
  78. glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
  79. glEnable(GL_BLEND);
  80. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  81. glDisable(GL_CULL_FACE);
  82. glDisable(GL_DEPTH_TEST);
  83. glEnable(GL_SCISSOR_TEST);
  84. glEnableClientState(GL_VERTEX_ARRAY);
  85. glEnableClientState(GL_TEXTURE_COORD_ARRAY);
  86. glEnableClientState(GL_COLOR_ARRAY);
  87. glEnable(GL_TEXTURE_2D);
  88. glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  89.  
  90. glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
  91. glMatrixMode(GL_PROJECTION);
  92. glPushMatrix();
  93. glLoadIdentity();
  94. glOrtho(draw_data->DisplayPos.x, draw_data->DisplayPos.x + draw_data->DisplaySize.x, draw_data->DisplayPos.y + draw_data->DisplaySize.y, draw_data->DisplayPos.y, -1.0f, +1.0f);
  95. glMatrixMode(GL_MODELVIEW);
  96. glPushMatrix();
  97. glLoadIdentity();
  98.  
  99. ImVec2 pos = draw_data->DisplayPos;
  100. for (int n = 0; n < draw_data->CmdListsCount; n++) {
  101. const ImDrawList* cmd_list = draw_data->CmdLists[n];
  102. const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
  103. const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
  104. glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
  105. glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
  106. glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
  107.  
  108. for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) {
  109. const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
  110. if (pcmd->UserCallback)
  111. pcmd->UserCallback(cmd_list, pcmd);
  112. else {
  113. ImVec4 clip_rect = ImVec4(pcmd->ClipRect.x - pos.x, pcmd->ClipRect.y - pos.y, pcmd->ClipRect.z - pos.x, pcmd->ClipRect.w - pos.y);
  114. if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f) {
  115. glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
  116. glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
  117. glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer);
  118. }
  119. }
  120. idx_buffer += pcmd->ElemCount;
  121. }
  122. }
  123.  
  124. glDisableClientState(GL_COLOR_ARRAY);
  125. glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  126. glDisableClientState(GL_VERTEX_ARRAY);
  127. glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture);
  128. glMatrixMode(GL_MODELVIEW);
  129. glPopMatrix();
  130. glMatrixMode(GL_PROJECTION);
  131. glPopMatrix();
  132. glPopAttrib();
  133. glPolygonMode(GL_FRONT, (GLenum)last_polygon_mode[0]); glPolygonMode(GL_BACK, (GLenum)last_polygon_mode[1]);
  134. glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
  135. glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
  136. }
  137.  
  138. void IMGUIExample_Draw(double elapsedMilliseconds)
  139. {
  140. //vals.m_pressed[0] = vals.m_pressed[1] = false;
  141. ImGuiIO& io = ImGui::GetIO();
  142. // Setup resolution (every frame to accommodate for window resizing)
  143. int w,h;
  144. int display_w, display_h;
  145. display_w = vals.back_w;
  146. display_h = vals.back_h;
  147. w = vals.win_w;
  148. h = vals.win_h;
  149. vals.dpi_scale = vals.back_w / vals.win_w;
  150. // Display size, in pixels. For clamping windows positions.
  151. io.DisplaySize = ImVec2((float)display_w, (float)display_h);
  152.  
  153. io.DeltaTime = elapsedMilliseconds /100.0; //convert in seconds
  154.  
  155. // Setup inputs
  156. double mouse_x = 0, mouse_y = 0;
  157. mouse_x = vals.m_coords[0];
  158. mouse_y = vals.m_coords[1];
  159. io.MousePos = ImVec2((float)mouse_x, (float)mouse_y);
  160. io.MouseDown[0] = vals.m_pressed[0];
  161. io.MouseDown[1] = vals.m_pressed[1];
  162.  
  163. ImGui::NewFrame();
  164.  
  165. if (ImGui::BeginMainMenuBar()) {
  166. if (ImGui::BeginMenu("File")) {
  167. if (ImGui::MenuItem("New")) {}
  168. if (ImGui::MenuItem("Open", "Ctrl+O")) {}
  169. if (ImGui::BeginMenu("Open Recent")) {
  170. ImGui::MenuItem("fish_hat.c");
  171. ImGui::MenuItem("fish_hat.inl");
  172. ImGui::MenuItem("fish_hat.h");
  173. if (ImGui::BeginMenu("More..")) {
  174. ImGui::MenuItem("Hello");
  175. ImGui::EndMenu();
  176. }
  177. ImGui::EndMenu();
  178. }
  179. if (ImGui::MenuItem("Save", "Ctrl+S")) {}
  180. if (ImGui::MenuItem("Save As..")) {}
  181. ImGui::Separator();
  182. if (ImGui::MenuItem("Quit", "Alt+F4"))
  183. [NSApp terminate:nil];
  184. ImGui::EndMenu();
  185. }
  186. if (ImGui::BeginMenu("Edit")) {
  187. if (ImGui::MenuItem("Undo", "CTRL+Z")) {}
  188. if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item
  189. ImGui::Separator();
  190. if (ImGui::MenuItem("Cut", "CTRL+X")) {}
  191. if (ImGui::MenuItem("Copy", "CTRL+C")) {}
  192. if (ImGui::MenuItem("Paste", "CTRL+V")) {}
  193. ImGui::EndMenu();
  194. }
  195. ImGui::EndMainMenuBar();
  196. }
  197.  
  198. ImGui::Begin("Sample window"); // begin window
  199. ImGui::End(); // end window
  200.  
  201. // Rendering
  202. glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
  203. glClearColor(220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f, 1.f);
  204. glClear(GL_COLOR_BUFFER_BIT);
  205. ImGui::Render();
  206. }
  207.  
  208. @interface AppView : NSOpenGLView {
  209. NSTimer *anim_timer;
  210. }
  211. @end
  212.  
  213. @implementation AppView
  214. -(void)anim_timer_fired:(NSTimer*)timer {
  215. [self setNeedsDisplay:YES];
  216. }
  217.  
  218. -(id)initWithFrame:(NSRect)frameRect pixelFormat:(NSOpenGLPixelFormat *)format {
  219. self = [super initWithFrame:frameRect pixelFormat:format];
  220. if (self)
  221. vals.last_clock = clock();
  222. return self;
  223. }
  224.  
  225. - (void)prepareOpenGL {
  226. [super prepareOpenGL];
  227.  
  228. #ifndef DEBUG
  229. GLint swapInterval = 1;
  230. [[self openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
  231. if (swapInterval == 0)
  232. NSLog(@"Error: Cannot set swap interval.");
  233. #endif
  234. }
  235.  
  236. - (void)drawView {
  237. NSWindow *mainWindow = [self window];
  238. NSPoint mousePosition = [mainWindow mouseLocationOutsideOfEventStream];
  239.  
  240. mousePosition = [self convertPoint:mousePosition fromView:nil];
  241. vals.m_coords[0] = mousePosition.x;
  242. vals.m_coords[1] = mousePosition.y - 1.0f;
  243.  
  244. clock_t thisclock = clock();
  245. unsigned long clock_delay = thisclock - vals.last_clock;
  246. double milliseconds = clock_delay * 1000.0f / CLOCKS_PER_SEC;
  247. IMGUIExample_Draw(milliseconds);
  248. vals.last_clock = thisclock;
  249.  
  250. [[self openGLContext] flushBuffer];
  251.  
  252. if (!anim_timer)
  253. anim_timer = [NSTimer scheduledTimerWithTimeInterval:0.017f target:self selector:@selector(anim_timer_fired:) userInfo:nil repeats:YES];
  254. }
  255.  
  256. -(void)setViewportRect:(NSRect)bounds {
  257. vals.win_w = bounds.size.width;
  258. vals.win_h = bounds.size.height;
  259.  
  260. if (vals.win_h == 0)
  261. vals.win_h = 1;
  262.  
  263. glViewport(0, 0, vals.win_h, vals.win_h);
  264. vals.back_w = vals.win_w;
  265. vals.back_h = vals.win_h;
  266. }
  267.  
  268. -(void)reshape {
  269. [self setViewportRect:self.bounds];
  270. [[self openGLContext] update];
  271. [self drawView];
  272. }
  273.  
  274. -(void)drawRect:(NSRect)bounds {
  275. [self drawView];
  276. }
  277.  
  278. #pragma mark -
  279.  
  280. -(BOOL)acceptsFirstResponder {
  281. return(YES);
  282. }
  283.  
  284. -(BOOL)becomeFirstResponder {
  285. return(YES);
  286. }
  287.  
  288. -(BOOL)resignFirstResponder {
  289. return(YES);
  290. }
  291.  
  292. -(BOOL)isFlipped {
  293. return(YES);
  294. }
  295.  
  296. -(void)keyUp:(NSEvent *)event {
  297. NSString *str = [event characters];
  298. ImGuiIO& io = ImGui::GetIO();
  299. int len = (int)[str length];
  300. for(int i = 0; i < len; i++) {
  301. int keymap = [str characterAtIndex:i];
  302. map_keys(&keymap);
  303. if(keymap < 512)
  304. io.KeysDown[keymap] = false;
  305. }
  306. }
  307.  
  308. -(void)keyDown:(NSEvent *)event {
  309. NSString *str = [event characters];
  310. ImGuiIO& io = ImGui::GetIO();
  311. int len = (int)[str length];
  312. for(int i = 0; i < len; i++) {
  313. int keymap = [str characterAtIndex:i];
  314. if (map_keys(&keymap) && !io.KeyCtrl)
  315. io.AddInputCharacter(keymap);
  316. if (keymap < 512) {
  317. if(io.KeyCtrl)
  318. reset_keys();
  319. io.KeysDown[keymap] = true;
  320. }
  321. }
  322. }
  323.  
  324. - (void)flagsChanged:(NSEvent *)event {
  325. unsigned int flags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
  326. ImGuiIO& io = ImGui::GetIO();
  327. bool wasKeyShift = io.KeyShift;
  328. bool wasKeyCtrl = io.KeyCtrl;
  329. io.KeyShift = flags & NSEventModifierFlagShift;
  330. io.KeyCtrl = flags & NSEventModifierFlagCommand;
  331. bool keyShiftReleased = wasKeyShift && !io.KeyShift;
  332. bool keyCtrlReleased = wasKeyCtrl && !io.KeyCtrl;
  333. if(keyShiftReleased || keyCtrlReleased)
  334. reset_keys();
  335. }
  336.  
  337. -(void)mouseDown:(NSEvent *)event {
  338. if (ImGui::GetIO().KeyShift)
  339. [super mouseDown:event];
  340. else {
  341. int button = (int)[event buttonNumber];
  342. vals.m_pressed[button] = true;
  343. }
  344. }
  345.  
  346. -(void)mouseUp:(NSEvent *)event {
  347. int button = (int)[event buttonNumber];
  348. vals.m_pressed[button] = false;
  349. [super mouseUp:event];
  350. }
  351.  
  352. - (void)scrollWheel:(NSEvent *)event {
  353. double deltaX, deltaY;
  354.  
  355. #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
  356. if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
  357. deltaX = [event scrollingDeltaX];
  358. deltaY = [event scrollingDeltaY];
  359.  
  360. if ([event hasPreciseScrollingDeltas]) {
  361. deltaX *= 0.1;
  362. deltaY *= 0.1;
  363. }
  364. }
  365. else
  366. #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
  367. {
  368. deltaX = [event deltaX];
  369. deltaY = [event deltaY];
  370. }
  371.  
  372. if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0) {
  373. ImGuiIO& io = ImGui::GetIO();
  374. io.MouseWheel += deltaY * 0.1f;
  375. }
  376. }
  377. @end
  378.  
  379. @interface AppDelegate : NSObject <NSApplicationDelegate>
  380. @property (nonatomic, readonly) NSWindow *window;
  381. @end
  382.  
  383. @implementation AppDelegate
  384. @synthesize window = _window;
  385.  
  386. -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app {
  387. (void)app;
  388. return YES;
  389. }
  390.  
  391. - (NSWindow*)window {
  392. if (_window != nil)
  393. return _window;
  394.  
  395. _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, WINDOW_W, WINDOW_H)
  396. styleMask:NSWindowStyleMaskResizable | NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView
  397. backing:NSBackingStoreBuffered
  398. defer:NO];
  399. if (!_window) {
  400. fprintf(stderr, "alloc() failed: out of memory\n");
  401. [NSApp terminate:nil];
  402. }
  403.  
  404. [_window center];
  405. [_window setTitle:@""];
  406. [_window makeKeyAndOrderFront:nil];
  407. [_window setMovableByWindowBackground:YES];
  408. [_window setTitlebarAppearsTransparent:YES];
  409. [[_window standardWindowButton:NSWindowZoomButton] setHidden:YES];
  410. [[_window standardWindowButton:NSWindowCloseButton] setHidden:YES];
  411. [[_window standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
  412.  
  413. return _window;
  414. }
  415.  
  416. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
  417. id menubar = [NSMenu alloc];
  418. id appMenuItem = [NSMenuItem alloc];
  419. [menubar addItem:appMenuItem];
  420. [NSApp setMainMenu:menubar];
  421. id appMenu = [NSMenu alloc];
  422. id quitTitle = [@"Quit " stringByAppendingString:[[NSProcessInfo processInfo] processName]];
  423. id quitMenuItem = [[NSMenuItem alloc] initWithTitle:quitTitle
  424. action:@selector(terminate:)
  425. keyEquivalent:@"q"];
  426. [appMenu addItem:quitMenuItem];
  427. [appMenuItem setSubmenu:appMenu];
  428.  
  429. NSOpenGLPixelFormatAttribute attrs[] = {
  430. NSOpenGLPFADoubleBuffer,
  431. NSOpenGLPFADepthSize, 32,
  432. 0
  433. };
  434.  
  435. NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
  436. id view = [[AppView alloc] initWithFrame:self.window.frame pixelFormat:format];
  437. #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
  438. if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
  439. [view setWantsBestResolutionOpenGLSurface:NO];
  440. #endif
  441. [self.window setContentView:view];
  442. if ([view openGLContext] == nil) {
  443. NSLog(@"No OpenGL Context!");
  444. [NSApp terminate:nil];
  445. }
  446.  
  447. ImGui::CreateContext();
  448. ImGuiIO& io = ImGui::GetIO();
  449. io.KeyMap[ImGuiKey_Tab] = 9;
  450. io.KeyMap[ImGuiKey_LeftArrow] = ImGuiKey_LeftArrow;
  451. io.KeyMap[ImGuiKey_RightArrow] = ImGuiKey_RightArrow;
  452. io.KeyMap[ImGuiKey_UpArrow] = ImGuiKey_UpArrow;
  453. io.KeyMap[ImGuiKey_DownArrow] = ImGuiKey_DownArrow;
  454. io.KeyMap[ImGuiKey_Home] = ImGuiKey_Home;
  455. io.KeyMap[ImGuiKey_End] = ImGuiKey_End;
  456. io.KeyMap[ImGuiKey_Delete] = ImGuiKey_Delete;
  457. io.KeyMap[ImGuiKey_Backspace] = 127;
  458. io.KeyMap[ImGuiKey_Enter] = 13;
  459. io.KeyMap[ImGuiKey_Escape] = 27;
  460. io.KeyMap[ImGuiKey_A] = 'a';
  461. io.KeyMap[ImGuiKey_C] = 'c';
  462. io.KeyMap[ImGuiKey_V] = 'v';
  463. io.KeyMap[ImGuiKey_X] = 'x';
  464. io.KeyMap[ImGuiKey_Y] = 'y';
  465. io.KeyMap[ImGuiKey_Z] = 'z';
  466. io.DeltaTime = 1.0f/60.0f;
  467. io.RenderDrawListsFn = ImImpl_RenderDrawLists;
  468. unsigned char* pixels;
  469. int width, height;
  470. io.Fonts->GetTexDataAsAlpha8(&pixels, &width, &height);
  471. GLuint tex_id;
  472. glGenTextures(1, &tex_id);
  473. glBindTexture(GL_TEXTURE_2D, tex_id);
  474. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  475. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  476. glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);
  477. io.Fonts->TexID = (void *)(intptr_t)tex_id;
  478.  
  479. ImGui::StyleColorsClassic();
  480. }
  481. @end
  482.  
  483. int main(int argc, const char * argv[]) {
  484. @autoreleasepool {
  485. [NSApplication sharedApplication];
  486. [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
  487.  
  488. id app_del = [[AppDelegate alloc] init];
  489. if (!app_del) {
  490. fprintf(stderr, "alloc() failed: out of memory\n");
  491. [NSApp terminate:nil];
  492. }
  493. [NSApp setDelegate:app_del];
  494.  
  495. [NSApp activateIgnoringOtherApps:YES];
  496. [NSApp run];
  497. }
  498. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement