int main(int argc, char **argv) { id app = nullptr; id pool = reinterpret_cast<id>(objc_getClass("NSAutoreleasePool")); if (!pool) { std::cerr << "Unable to get NSAutoreleasePool!\nAborting\n"; return -1; } pool = objc_msgSend(pool, sel_registerName("alloc")); if (!pool) { std::cerr << "Unable to create NSAutoreleasePool...\nAborting...\n"; return -1; } pool = objc_msgSend(pool, sel_registerName("init")); app = objc_msgSend(reinterpret_cast<id>(objc_getClass("NSApplication")), sel_registerName("sharedApplication")); NSRunAlertPanel(CFSTR("Testing"), CFSTR("This is a simple test to display NSAlertPanel."), CFSTR("OK"), nullptr, nullptr); objc_msgSend(pool, sel_registerName("release")); }
void CheckMachinePowerSanity() { MachinePower power = GetMachinePower(); if (power == MACHINE_POWER_WIMPY) { #ifdef NDEBUG long result = NSRunAlertPanel(CFSTR("Underpowered Machine"), CFSTR("Your machine does not have enough power to run the Apollo engine properly. If you choose to continue, you may experience performance difficulties."), CFSTR("Quit"), CFSTR("Continue"), 0); if (result != 0) exit(0); #endif } }