c++objective-clinuxios4

Compiling/Running C++ code on iPhone


I have recently created an Asteroids game/app for one of my CS classes with openGL, GLU and C++ for Linux. The teacher told me that if I get it to run on the iPhone he would give me extra credit. I have been looking around and I think I have to develop/port it to Objective C using the iPhone Development Kit. My questions are:

I have not tried anything yet, because I would like to know first what you guys think. You do not have to tell me exactly what to do, but I would highly appreciate if you would point me in the right direction.

Thanks.


Solution

  • Well, if you don't want to port your program into another language. You CAN use SDL2, it seems pretty stable and it works on iOS (iPhone/iPad/iPod Touch). All you would have to do is change your code and then play around with the controls. You'll have to clone the Mercurial repo from http://hg.libsdl.org/. It will come with a README.iOS file, in which describes how the port works and some other details. I am not sure if it has multi-touch support yet, I have not tested it.

    Also, you can use immediate mode on the iPhone, you just can't use OpenGL ES 2 if you do that. All you have to do is make a context for OpenGL ES 1.1.

    And you WILL need a Mac, or perhaps you could get a Hackintosh to compile your code and then run it with a jailbroken iPod/iPhone/iPad.

    NOTE: I believe I have heard of some people compiling their code on a Hackintosh and then submitting it to the app store from a Mac within an Apple store.