Menus

I'm very ignorant of Cocoa stuff, but eventually want to take some time and learn to use it well. I'd be interested in the results if anyone does go through this process for SDL, because I spent the max time I'm going to spend on it at this point. (5-10 minutes ) After following the previous two suggestions I got "Unable to load nib file: MainMenu, exiting" on execution (even after adding it to the project. :/ )
Here's a couple of great sites for learning much more:http://cocoadevcentral.comhttp://www.projectomega.org

DM6 Wrote:My project will load the MainMenu.nib I made, and the menus show up, but now it doesn't bring up my OpenGL window!

Well thats farther than it got for me. I set SDL_USE_NIB_FILE to 1, and copied the nib file to the Resources directory on the project (by dragging and dropping it there), but when I go to start the app the console says: 2004-08-29 19:26:46.180 Celda[1599] Unable to load nib file: MainMenu, exiting

I actually have tried to play around with this as well, but I got stuck one step after the 'unable to load nib file'- you just need to go into the Info.plist and change MainMenu to SDLMain... however, after that I got something like 'cannot attach event to class SDLMain' or somesuch. Thus I gave up and instead made it so the .m code sets up menus instead of trying to put them into resources. I found this to be much easier, and when it's more functional I'll post, unless someone comes up with something better.

This has come up recently on the SDL mailing lists. Apparently, the updated version may pop up in CVS soon. One of the regulars (Max Horn) had a patch he forgot to submit, but he's not sure if it's 10.2 compatible. I asked him by email for a copy of the updated (possibly official) SDLmain and I'll let you guys know if it works as advertised... just waiting now.

Just backup your old SDLMain.m remove it from your project and then replace it with the new SDLMain.m, recompile and the standard menus will be in place. (The .patch file is there for those interested but you really don't need it.)

If anyone can test this on 10.2, please do. Max wasn't sure if it was compatible.

There are some small problems, however. If your app hides the mouse pointer, it will be hard to close the about box as even command-W won't work (you need to click on the desktop and then click the close button.) Also, I have no idea about compatibility issues on this one and it's very untested. Test away, though! Also, you are now using an altered version of SDL so along with your app, you'll have to provide links to your modified SDL source to be compliant with the license.

UPDATE: I added the SDLMain.m with all of the changes to that archive, the menu only version is in a folder called "without shortcuts active" and it has Max's patch and pure version as it will be probably added to CVS.

PowerMacX Wrote:Now, all I need is to get SDL source to compile without errors so I can add that little "minimize fix" for OpenGL contexts...

Have you checked out arekkusu's thread about this? I asked about help for SDL and he had a suggestion, but I just don't have time for this right now. If you figure it out, please post there for all to see.

I found it right after making the previous post, but I already have that code, and in fact the SDL source already has a comment about this too, but my problem is that I haven't been able to compile it (I'm not in my mac right now, but basically there seem to be some missing headers ).

If I make it work, I'll post here (and a detailed post in that other thread).

Also, I tried the menu code, it worked great ! I made a little change: I added a (disabled) Preferences... menu & a separator, so the application menu looks "right". The disabled preferences menu (that is, it has nil assigned as it's action) serves in my opinnion to maintain the "spatial memory" about menus: Having the Hide menu item right below About feels odd.