Newb question- UIAlertview and other os specific methods

Newb question- UIAlertview and other os specific methods
0.0 0


I have a few games in App Store for iPhone/iPad and am still pondering some things about cocos2d-x and how certain things might work.

I am interested in starting to develop for Android as well (have never done any android stuff yet) and am wondering is if there are some best practice for platform specific things.

For example, in iOS I use UIAlertView’s all the time. What would the equivalents be on Android and Windows for example, and is there something more generic that could be used in cocos2d-x (a single call) that would automatically call the appropriate popup on the proper platform, or do I need to do platform specific calls for each one.

My impression (which I hope is wrong) is that although you are creating one code base, you pretty much have to write separate versions of the code for each platform… so I am imagining something like this everywhere:

if (iOS) {
//do ios specific code
} else if (android) {
//do android specifc code
} else if (windows) {
//do windows specific code
} else {
/do mac specific code

So it almost seems that you are rewriting all your code for each platform anyways, so is there really much advantage to this?



GUI is a weakness of cocos2d-x. In current version, we group all GUI components into root/extensions/GUI folder.
What you need is a model dialog frame, am I right?


Well I guess yes … I am just asking really how it would be handled, and how you would handle other platform specific type issues like this.