Porting a C++ game to iPhone - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Porting a C++ game to iPhone (/thread-2585.html)
Porting a C++ game to iPhone - Rasterman - Jun 11, 2008 08:18 AM
As far as I can tell you must write your program in Objective C, is this correct? From my limited research Objective C is built on C, and replaces C++. Would the easiest way to port a C++ game to run on the iPhone be to simply convert the code to pure C? Are there any conversion utilities to convert C++ to Objective C or aid in this process?
Is there any way to compile or run C++ on the iPhone? Perhaps by sticking it in a library or DLL?
Porting a C++ game to iPhone - ThemsAllTook - Jun 11, 2008 08:45 AM
C++ should compile and run with no problem. You'll need to write at least a small amount of Objective-C or Objective-C++ glue code to work with the system and set stuff up, but other than that, there's no reason at all you can't use C++ for everything else.
Porting a C++ game to iPhone - Duane - Jun 11, 2008 04:44 PM
Anyone ported SDL to the iphone yet?
Porting a C++ game to iPhone - sealfin - Jun 12, 2008 12:47 AM
Sam Lantinga Wrote:SDL is participating in the Google Summer of Code!
So, not yet it would seem...
Porting a C++ game to iPhone - jAuriya - Jun 12, 2008 02:24 AM
Good news! But even so.. I doubt Apple would allow unofficial libraries (SDL) to be sold/given through AppStore since they officially chose OpenGL ES for the iPhone/Touch?
If they'll allow SDL through the AppStore, then I'm in for a much easier road!
Porting a C++ game to iPhone - TomorrowPlusX - Jun 12, 2008 03:46 AM
I can't imagine Apple would prevent SDL. SDL is just a bootstrap for events and for getting graphics context abstractions ( and that includes OpenGL ).
Porting a C++ game to iPhone - OneSadCookie - Jun 12, 2008 03:49 AM
SDL would not be sold or distributed via the app store... it'd be provided to you, the developer, in exactly the same way it is for Mac OS X, most likely.
Porting a C++ game to iPhone - jAuriya - Jun 12, 2008 03:55 AM
I'm sorry, I wasn't clear in my previous post ;p
I mean, if iPhone SDL would be released and we could create games using that SDL, I doubt Apple would let us distribute our games through the AppStore because we didn't use the official library (OpenGL ES?) they have chosen for the iPhone?
Porting a C++ game to iPhone - Cochrane - Jun 12, 2008 04:11 AM
Why wouldn't they? It's just a wrapper around existing libraries, after all.
Porting a C++ game to iPhone - jAuriya - Jun 12, 2008 04:34 AM
Cochrane Wrote:Why wouldn't they? It's just a wrapper around existing libraries, after all.
Cochrane, thank you. You've just made my day!
This means I can continue working on my project and eventually make it available before first having to learn OpenGL ES!
I don't know very much about such stuff yet, been only in the programming scene for about half a year now so I can sound pretty not-knowing sometimes.
Porting a C++ game to iPhone - OneSadCookie - Jun 12, 2008 06:23 PM
I doubt that SDL software drawing routines would be fast enough on the phone. You'll almost certainly still have to use OpenGL for graphics, which implies learning OpenGL ES for the iPhone port. SDL would just be for getting a window on the screen and handling events... and given the events are completely different to what you'd get with a keyboard and mouse, the event handling code won't be common, so... just getting a window on the screen. At that point, why bother?
Porting a C++ game to iPhone - reubert - Jun 12, 2008 08:42 PM
I agree with OSC there, I don't see how the main parts of SDL would be at all useful for games on the iPhone. SDL_image and some of the other add ons could be useful, but only if you were trying to make a cross platform (including windows) code base. And if you're making a game that could share the same source at such a low level for both a windows version and an iPhone version, you're going to have a hard time whatever you chose.
If you want to make a game easy to port later use OpenGL (doesn't have to be OpenGL ES). For all your rendering, including UI, and OpenAL for your audio. Also keep a few key iPhone specific things in mind, like your app could be told to quit at any time, so you need to be able to save quick and restore state just as quick. Also battery usage is important so keep your CPU usage down and of course the user input methods are very unique and need to be designed for.
Porting a C++ game to iPhone - AnotherJake - Jun 12, 2008 09:48 PM
I agree with OSC and Reubert. I just don't see how SDL on iPhone would be able to add any advantage to simply programming directly on iPhone. It's going to have to use OpenGL ES anyway, and software rendering is going to be hard to make happen with the limited resources. Not saying it won't happen, but I'm skeptical of how useful or advantageous it would be.