iPhone C++ programming

3 12 2008

I am a hardcore C++ fan and I really dislike Objective C.

I decided to take a look to the iPhone SDK and see if I can make some OpenGL programming using pure C++.

I found that it’s really easy to mix both languages in the same project. You can even mix Objective C and C++ code in the same file just by adding the “.mm” extension to your files, instead of “.cpp”.

Using the OpenGL ES example bundled in the SDK I made a wrapper in C++ that receives the iPhone events I need, like input and drawing.

I modified the example so it calls to my wrapper in every drawing and input event and then, the wrapper calls to my pure C++ objects.

I can now concentrate my efforts in writing the logic and drawing methods in pure C++ and see the changes in my iPhone :mrgreen:



Actions

Informations

6 responses to “iPhone C++ programming”

11 12 2008
Bob (17:56:22) :

Sounds great, any chance of some source code? :)

30 03 2009
_CONEJO (20:23:52) :

Yeah… any change of having those wrap? I’m starting with iPhone, but the reference/examples at the developer program seems to be very bad organized (or I can not find what I want…)

Since objetive C sucks (at least for me) I prefer to go for C++ (it will be easier to port my games which are already in C++ for the iPhone!

I will appreciate any help (just throw me an email)

25 07 2009
xenonin (00:46:02) :

Would you give us an example with source?

25 07 2009
Ignacio Sánchez (00:59:00) :

Sure! I’ll work on a coding example as soon as I can :)

27 08 2009
John Harrison (19:19:19) :

Any chance of that example appearing anytime soon? I have a c++ game that I’d like to port.

Thanks!
John

27 08 2009

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image