src/video/cocoa/SDL_cocoavideo.m
changeset 6832 156e608ec4ef
parent 6788 036f53f2f5aa
child 6836 b0ca1571caf3
equal deleted inserted replaced
6831:935b871e1ffe 6832:156e608ec4ef
   248             fprintf(stderr, "Assertion failed AND couldn't init video mode!\n");
   248             fprintf(stderr, "Assertion failed AND couldn't init video mode!\n");
   249             return SDL_ASSERTION_BREAK;  /* oh well, crash hard. */
   249             return SDL_ASSERTION_BREAK;  /* oh well, crash hard. */
   250         }
   250         }
   251     }
   251     }
   252 
   252 
   253     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   253     @autoreleasepool {
   254 
   254         NSString *msg = [NSString stringWithFormat:
   255     NSString *msg = [NSString stringWithFormat:
   255                 @"Assertion failure at %s (%s:%d), triggered %u time%s:\n  '%s'",
   256             @"Assertion failure at %s (%s:%d), triggered %u time%s:\n  '%s'",
   256                     data->function, data->filename, data->linenum,
   257                 data->function, data->filename, data->linenum,
   257                     data->trigger_count, (data->trigger_count == 1) ? "" : "s",
   258                 data->trigger_count, (data->trigger_count == 1) ? "" : "s",
   258                     data->condition];
   259                 data->condition];
   259 
   260 
   260         NSLog(@"%@", msg);
   261     NSLog(@"%@", msg);
   261 
   262 
   262         /*
   263     /*
   263          * !!! FIXME: this code needs to deal with fullscreen modes:
   264      * !!! FIXME: this code needs to deal with fullscreen modes:
   264          * !!! FIXME:  reset to default desktop, runModal, reset to current?
   265      * !!! FIXME:  reset to default desktop, runModal, reset to current?
   265          */
   266      */
   266 
   267 
   267         NSAlert* alert = [[NSAlert alloc] init];
   268     NSAlert* alert = [[NSAlert alloc] init];
   268         [alert setAlertStyle:NSCriticalAlertStyle];
   269     [alert setAlertStyle:NSCriticalAlertStyle];
   269         [alert setMessageText:msg];
   270     [alert setMessageText:msg];
   270         [alert addButtonWithTitle:@"Retry"];
   271     [alert addButtonWithTitle:@"Retry"];
   271         [alert addButtonWithTitle:@"Break"];
   272     [alert addButtonWithTitle:@"Break"];
   272         [alert addButtonWithTitle:@"Abort"];
   273     [alert addButtonWithTitle:@"Abort"];
   273         [alert addButtonWithTitle:@"Ignore"];
   274     [alert addButtonWithTitle:@"Ignore"];
   274         [alert addButtonWithTitle:@"Always Ignore"];
   275     [alert addButtonWithTitle:@"Always Ignore"];
   275         const NSInteger clicked = [alert runModal];
   276     const NSInteger clicked = [alert runModal];
   276 
   277     [pool release];
   277         if (!initialized) {
   278 
   278             SDL_QuitSubSystem(SDL_INIT_VIDEO);
   279     if (!initialized) {
   279         }
   280         SDL_QuitSubSystem(SDL_INIT_VIDEO);
   280 
   281     }
   281         return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn);
   282 
   282     }
   283     return (SDL_assert_state) (clicked - NSAlertFirstButtonReturn);
       
   284 }
   283 }
   285 
   284 
   286 #endif /* SDL_VIDEO_DRIVER_COCOA */
   285 #endif /* SDL_VIDEO_DRIVER_COCOA */
   287 
   286 
   288 /* vim: set ts=4 sw=4 expandtab: */
   287 /* vim: set ts=4 sw=4 expandtab: */