Menus

Member
Posts: 233
Joined: 2003.05
Post: #16
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 Wink ) 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.com
http://www.projectomega.org

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
DM6
Unregistered
 
Post: #17
My project will load the MainMenu.nib I made, and the menus show up, but now it doesn't bring up my OpenGL window!
Quote this message in a reply
Diplomtennis
Unregistered
 
Post: #18
I am glad I am not the only one... Wink
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2004.08
Post: #19
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
Quote this message in a reply
Apprentice
Posts: 12
Joined: 2004.08
Post: #20
Anyone get this to work correctly yet?
Quote this message in a reply
Member
Posts: 184
Joined: 2004.07
Post: #21
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.
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #22
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.

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
DM6
Unregistered
 
Post: #23
Has anyone heard any new developments on this issue? I know a lot of people who'd really like some menus in their SDL apps.

-Duncan
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #24
I've been trying too with no luck, anyone else?
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #25
Good news! Wow

This may not be a perfect solution, but that's only because it hasn't been thorougly tested. No messing with .nibs either. Smile

A while back (as I mentioned a few posts ago) I got a patch for sdlmain.m. I didn't know how to use it right away, so I finally just did it manually by hand.

Here's a zip archive with the new SDLMain.m and the patch file if your interested:
Click here to download

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.

You can also get the menu shortcut keys to work by following the instructions at this link: http://thread.gmane.org/gmane.comp.lib.sdl/18431 Check this post: 14 Oct 19:33 John Tanner

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.

BTW, I found all this by monitoring http://news.gmane.org/gmane.comp.lib.sdl SDL's official newsgroup.

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.

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #26
Great! I'll try this today. Smile

(Now, all I need is to get SDL source to compile without errors so I can add that little "minimize fix" for OpenGL contexts... Wacko and I'll have a well behaving Mac game Wink )

(The "Special Thanks" section in Okugai's readme keeps getting bigger every time I visit these forums!)
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #27
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. Smile

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #28
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 Blink ).

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 Smile ! 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. Ninja
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #29
Here's a thread about building. Not sure if it will help you:
http://www.idevgames.com/forum/showthread.php?t=7795

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #30
I got the minimize fix to work. It's quite simple, but does anyone want to see it?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Does SDL have any support for pull down menus? WhatMeWorry 2 2,547 Nov 6, 2005 01:12 AM
Last Post: PowerMacX