Advertisement

Porting an SDL project from Win to Mac

Started by September 01, 2005 02:00 AM
3 comments, last by Peregrin 19 years, 1 month ago
Hi, I am working on porting Jooleem to OS X, not with a great degree of success so far. I don't have any previous experience with OS X, since my last Apple was a IIc. Anyway, since the game was developed with portability in mind, I got it to compile in XCode in less than an hour. Got to love SDL :). It runs beatifully. I have a some issues, though, that maybe you can help me clear up: 1. I have created a package using PackageMaker, and it installs nicely on my machine, and the game works. However, when a user tried to install the package, the game refuses to run. He says there is just a blank window, with no error message. I suspect this might have something to do with him not having the SDL frameworks installed. In Windows, I just copy the required DLLs to the executable's folder. What is the mac equivalent? 2. The exectable created is over 12 MB in size. The windows executable is about 400 KB. What am I doing wrong? 3. The application icon looks like it only has 1-bit alpha, although the source PNG has an 8-bit alpha channel. I know this is a problem with the WIN32 version of SDL_WM_SetIcon, but I didn't find a reference to it on OS X. Is there a platform specific way to override SDL_WM_SetIcon and make my icon render nicely?
Jooleem. Get addicted.
Quote: Original post by Peregrin
1. I have created a package using PackageMaker, and it installs nicely on my machine, and the game works. However, when a user tried to install the package, the game refuses to run. He says there is just a blank window, with no error message. I suspect this might have something to do with him not having the SDL frameworks installed. In Windows, I just copy the required DLLs to the executable's folder. What is the mac equivalent?
Embedding the SDL framework into your application bundle. See here.

Also, I got burned in the past when I distributed my game with an installer. People don't like it; it seems that on Mac, what they prefer is something that runs directly from the disc image. As you can package your entire app as a single bundle, it's then just a question of dragging and dropping that bundle from the disc image into the Applications folder if they want to keep it.

Quote: 2. The exectable created is over 12 MB in size. The windows executable is about 400 KB. What am I doing wrong?
Is that the actual binary, or the .app? If it's the binary, I'm not sure, perhaps you're building a debug version or something. If it's the .app, open it up and have a look at what's inside it to see what's taking up all the space.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Advertisement
Thanks for the quick reply, superpig.

Quote:
As you can package your entire app as a single bundle...


I apologize for the newbish question, but how do I do that?
Jooleem. Get addicted.
If you're building with something like XCode, that's how it'll be coming out by default. A .app file isn't a binary - it's basically just a directory which OSX treats in a special way due to the .app on the end of the name. Packaging the game as a bundle means putting all your resources and stuff inside that folder somewhere; you should then be able to reference them by building paths that treat the .app file as a regular directory.

However, I'm afraid I've never really done it myself - I mentioned that I got burned on a project, well, I've not actually done another Mac project since [smile] Got advised as to what I should look into for next time back then, but haven't tried it out myself yet. Sorry I can't be more help.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

I didn't realise that the .app file contained all the game's resources. That explains why it is so large.

What is the path for the resource file in the bundle, relative to the executable?
Jooleem. Get addicted.

This topic is closed to new replies.

Advertisement