Jump to content

  • Log In with Google      Sign In   
  • Create Account


Hinchy

Member Since 23 Oct 2011
Offline Last Active Apr 14 2012 12:32 PM

Posts I've Made

In Topic: Having loads of trouble compiling C++ SDL/OpenGL project on Mac OS X

13 April 2012 - 11:38 PM

http://wearethelayabouts.com/content/games/launchman

Here we go, there it is. Thanks szymczyk, couldn't have done it without your help. Posted Image

In Topic: Having loads of trouble compiling C++ SDL/OpenGL project on Mac OS X

12 April 2012 - 02:00 PM

There's a possible fix to your problem in the comments to the Using SDL with Xcode 4 article I linked to earlier in this thread. Read adam's comment.

YES! THAT'S IT!

In Topic: Having loads of trouble compiling C++ SDL/OpenGL project on Mac OS X

11 April 2012 - 10:32 PM

[stuff]

Thank you!




So, here's an update. I noticed something interesting in the GDB logs: http://pastie.org/3772361

This happens when SDL.framework is located in both /Library/Frameworks and the application bundle.

If I remove SDL.framework from /Library/Frameworks, the game refuses to open, OS X complaining that the game's not compatible etc etc.

If I remove SDL.framework from the application bundle... the game runs! Until it crashes at Crypto++, anyway (keep in mind that's a statically linked library, not a framework, as that's all I could find for it on OS X).

EDIT: I've narrowed the problem child down to just SDL.framework... the SDL_* frameworks all work just fine.

EDIT 2: Manage to fix Crypto++. So, now all we have to do is get SDL.framework to play nice...

In Topic: Having loads of trouble compiling C++ SDL/OpenGL project on Mac OS X

11 April 2012 - 12:16 AM

You most likely have a working directory problem where the game can't find your image, sound, and data files. The simplest solution is to open the SDLMain.m file and change the working directory to your app bundle's Resources folder. More detailed information on changing the working directory is in the following article:

SDL Tips for Mac OS X

I'm not really sure what to do with the code in that article. Objective-C confuses the heck out of me.

Though for what it's worth my resources are actually loading, or at least the images are -- on the splash screen, if I disable SDL_PollEvent, I see the splash screen as it would normally display.

I of course still would like to figure out where to put that code, as having the resources in the app bundle would be quite preferable.

Here's my setupWorkingDirectory code:


/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
    if (shouldChdir)
    {
	    char parentdir[MAXPATHLEN];
	    CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
	    CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
	    if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
		    chdir(parentdir);   /* chdir to the binary app's parent */
	    }
	    CFRelease(url);
	    CFRelease(url2);
    }
}

In Topic: Having loads of trouble compiling C++ SDL/OpenGL project on Mac OS X

10 April 2012 - 07:21 PM

Turns out I was being incredibly dense and using #elseif instead of #else. Now it compiles.

However, now the program is crashing with an EXC_BAD_ACCESS signal at SDL_PollEvent(&event).
If I remove the event handling code, the game runs, though obviously without input.

Also, if I force it to skip the splash screen and start the level, it crashes with an EXC_BAD_ACCESS signal at the call to the encryption library I use to encrypt level and save data (Crypto++).

It's also worth nothing that while the splash screen runs, no sound plays on it.

PARTNERS