Menus

Anyone have a good example on how to hook up some UI elements (specifically menus) to a C++/OpenGL/SDL app? I know Interface Builder is supposed to be easy, as is Cocoa, and I'm not trying to get out of learning them. But a good example project would help me a LOT more than Apple's docs. Many thanks for any help.

Rolling your own for your exact needs is usually good enough for editing apps (that no one else but your development team will use) or games that have limited menus...

If you are making a final game with menus as your main interface (eww!) you either need to rely heavily on one of the libraries mentioned above or use platform specific code like Cocoa. If you are going mac only, I'd say go Cocoa all the way. Interface builder + Cocoa, etc. will save you days of work. (So I hear. )

Yes, but as I said, if you are using SDL with C or C++ then you are 'trapped' within your own C/C++ code. The only route in to modify the interface is to modify the .nib file which has the main menu bar etc. Even editing the SDLMain.m file, which would allow you to forward events from the UI to your C code, there is no route for you to control the UI from your code, for example to show dialog boxes using Cocoa.

Thanks for clearing it up IBethune, I wasn't sure whether it was possible to do it through .nibs and Cocoa with SDL. But the GUI libraries on libsdl.com are too numerous to choose. Let's say it's for an action game that plays in a window, so menus would not be the main interface to the game. I want to keep the menus outside the OpenGL context, in the menubar where they belong. Any advice for which library is best suited to these needs/most reliable? Thanks for your help so far guys.

no library compatible with SDL is going to give you access to the standard menu bar. Those GUI libs can only reach the graphics context you set up with SDL. You'd have to use IBethune's method to get access, and like he said, that's for MENU's only. Beyond that it would mean making a lot of Mac OS specific changes to the SDL code... perfectly legal as long as you supply a link to your version of the code with your game... however probably not worth the effort needed.

OK, so if I'm fine with restricting myself to menus only, any tips on how to start modifying the .nib file? I'm a C++ programmer and I have no cocoa experience; any tutorials or sample files that could make it clear to me?