Mixing Objective-C and C++: Game Loop Parts
Posted
by
Peteyslatts
on Game Development
See other posts from Game Development
or by Peteyslatts
Published on 2013-07-01T19:21:05Z
Indexed on
2013/07/01
23:15 UTC
Read the original article
Hit count: 579
I'm trying to write all of my game in C++ except for drawing and game loop timing. Those parts are going to be in Objective-C for iOS.
Right now, I have ViewController handling the update cycle, but I want to create a GameModel class that ViewController could update. I want GameModel to be in C++. I know how to integrate these two classes. My problem is how to have these two parts interact with the drawing and image loading.
GameModel will keep track of a list of children of type GameObject. These GameObjects update every frame, and then need to pass position and visibility data to whatever class or method will handle drawing.
I feel like I'm answering my own question now (talking it out helps) but would it be a good idea to put all of the visible game objects into an array at the end of the update method, return it, and use that to update graphics inside ViewController?
© Game Development or respective owner