Using an existing C++ engine on the iPhone


Using an existing C++ engine on the iPhone



I come from a C/C++ background and more recently flash. Anyway I wrote a 2D engine in AS3 and would like to get it running on the iPhone. To start with I converted it to C++. As a test I wrote a very simple C++ engine and added the files to a standard view-based application in XCode. I then added a UIImageView that covered the whole iPhone screen.

The way my test engine is set up at the moment is that each frame it renders the result to an image which is then used to update the UIImageView every frame. Assuming I can pass input from the iPhone to the C++ engine this seems like a fairly platform-independent solution. Since I have been coding for iPhone/Mac for less than 1 day I was wondering whether this is the standard approach to getting an existing C++ engine running on the iPhone and if not, what is?


How do you get an iPhone's Device Name in C#

1:

How do you get the viewport scale after pinch/zoom on an iPhone web app?
There's no problem in you rendering into an image and refreshing this image, although you receive no acceleration from the GPU using this technique. asp.net Mobile implementation on IPhone, Blackberry and other mobile devicesSo you'd be burning a lot of CPU cycles, which in turns eats battery.. Using an Objective-C++ file from a C++ file If the objects you are rendering must be described in normal graphics primitives, be sure to use the drawing APIs which are optimised for the platform and must delegate job to the GPU.. Saving a string into file in Objective-C (iPhone) An alternative approach is to make use of OpenGLES, although this has a learning curve. Storing a persistent CLLocation
Reading and Updating application settings from NSUserDefaults using Flipside View ControllerSelect Multiple Images (UIImagePickerController or Photos.app Share UI)

2:

Yes, this is a fairly normal way to handle it. Generally you would either use small Objective C stubs for your events and things like pushing out the frame, or you would setup an OpenGL context and then pass it to your C++ code..


82 out of 100 based on 47 user ratings 842 reviews

#