![]() ![]() make sure the application singleton has been instantiated We will need to wrap everything in an autorelease pool, and make sure we have an instantiated application - we do this as such: Now that our main function looks like a generic C program, we can begin recreating what the NSApplicationMain did for us. ![]() In it’s place we simply return zero, as cocoa will call exit() before reaching the return instruction of the main function, so this never gets executed anyway. The first thing we do, is to get rid of the NSApplicationMain function call. In order to avoid the nib, we need to circumvent this by initiating the application ourselves. The return NSApplicationMain(argc, (const char **) argv) instantiates your application by creating the singleton object NSApplication, loading the MainMenu.xib (the nib) and calling the run method on your NSApp. Return NSApplicationMain(argc, (const char **) argv) The standard main.m looks something like this: #import ![]() Games in particular usually incorporate their own GUI, which is managed by the engine.Īs far as I know, there is no Apple-sanctioned method of approach of doing nibless development under cocoa, and the method I will show you is probably not the only way - or the best, for that matter. This is true for projects that have little or no GUI based on the AppKit, like fullscreen games. Well, there are projects where it just doesn’t make sense to use Interface Builder, rendering the NIB obsolete to the project itself. I prefer being able to visualize what my application does in the code by avoiding the NIB altogether - and I’m going to show you how I go about doing this. I’ve never really used the Interface Builder all that much when developing, and frankly I don’t like the “magic” it does for me. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |