The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL 1.3 menu bars and OS X?
VernJensen


Joined: 09 Dec 2009
Posts: 159
I'm rather new to Interface Builder in OS X. If I create a new project using the Cocoa Application template, it auto-creates a MainMenu.nib file for me. If I drag that file into my existing SDL 1.3 application, it doesn't get used -- instead, a more basic menu bar seems to get created automatically by SDL. I'm wondering how I can use my own menu bar instead of having SDL create a basic one for me?

-Vern
SDL 1.3 menu bars and OS X?
Ryan C. Gordon
Guest

On 06/07/2011 11:42 AM, VernJensen wrote:
Quote:
I'm rather new to Interface Builder in OS X. If I create a new project
using the Cocoa Application template, it auto-creates a MainMenu.nib
file for me. If I drag that file into my existing SDL 1.3 application,
it doesn't get used -- instead, a more basic menu bar seems to get
created automatically by SDL. I'm wondering how I can use my own menu
bar instead of having SDL create a basic one for me?

You have two options:

1) Use the built-in menu from SDL, and use Cocoa calls (NSMenu) to add
menus to the menu bar that SDL created.

2) Before calling SDL_Init(), call [NSApplication sharedApplication] and
create your main menu (either programmatically or with a .nib file). SDL
won't set up a menu for you if it sees one already exists.

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: SDL 1.3 menu bars and OS X?
VernJensen


Joined: 09 Dec 2009
Posts: 159
Ryan C. Gordon wrote:

You have two options:

1) Use the built-in menu from SDL, and use Cocoa calls (NSMenu) to add
menus to the menu bar that SDL created.

2) Before calling SDL_Init(), call [NSApplication sharedApplication] and
create your main menu (either programmatically or with a .nib file). SDL
won't set up a menu for you if it sees one already exists.


Thanks Ryan. I tried calling [NSApplication sharedApplication] (have no idea what this does), and indeed, now SDL does not create a menu for me. But neither does it use the menu in my .nib file. Is there code I must specifically call to tell Cocoa to use the .nib file? Sorry, I'm so new to all of this!

If you have a webpage that'd point me in the right direction, I'd be happy to read that too. Thanks again.
SDL 1.3 menu bars and OS X?
Ryan C. Gordon
Guest

Quote:
If you have a webpage that'd point me in the right direction, I'd be
happy to read that too. Thanks again.

http://cocoadev.com/ is a good start if you want to really get into
Objective-C and Cocoa.

The likely problem (having very little experience with this myself) is
that you didn't specify your .nib file in your app's Info.plist...if
you're building your app like a Windows .exe (or a Unix binary)--no .app
bundle directory thing--you'll need to load the nib yourself (use the
NSNib class).

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org