iDevGames Forums
(just sharing) C++ to Objective-C callbacks - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: (just sharing) C++ to Objective-C callbacks (/thread-9978.html)

(just sharing) C++ to Objective-C callbacks - godexsoft - Apr 11, 2012 06:37 PM

Hi guys,

I just want to share a nice little one-file-lib I written for my daily needs. Its use is not limited or strictly coupled to game development but you might find it useful if you mix objective-c with c++.

The problem: You have some objective-c code (pretty common on iOS hehe). Your objective-c part is mainly UI (if you mix with UIKit for example) but your logic and game code is written in c++ (to keep things cross-platform for example). Your 'core' wants to notify your UI/Objective-C part about just anything happening in the 'core'. You want to pass some data to your UI and maybe you even want to return a value back from the UI into your c++ 'core'. How do you do that?

The (one of possible) solution:

Hope you find it as useful as I do Smile