Sunday, February 12, 2017

Android game development in c++


So being a primarily c/c++ developer, I've always thought that the only option for mobile game development for me was using iOS, which allows for c/c++ (and minimising objective C).


I heard from a friend though, that android has a native development toolkit which allows for c++ code to work on android.


Has anyone used this, and if so, how do you find it? I mean, will it "just work" like iOS, or are there more considerations that need to be taken care of due to the wide variety of android devices available?



Answer



Android APIs are Java. Since 2010, Google provides the NDK (a SDK) for C/C++ developers.



The NDK offers two ways:



  • for android 1.5 devices, you can load an elf library and uses it from the java application via a JNI bridge

  • for android 2.3 devices, you can use a NativeActivity to bypass the Java Activity code for Fullscreen Application.


The NDK offers few C/C++ API:



  • a pseudo libc called bionics: many functions aren't availabled

  • a pthread library

  • OpenGL ES 1.x (>Android 1.5) and OpenGL ES 2.x (Android 2.0)


  • OpenSL (limited support on Android 2.3)


But many API are Java only (also available via JNI).


NDK 5 version is the first usable for C++ developers because it offers:



  • RTTI

  • Exceptions supports

  • STLport

  • gdb support for multi-threaded programs



The most painful operation is debugging on android devices. So i develop my own multi-platform framework (OS X, Windows, Linux, iOS and Android) to debug first on desktop platform, next iOS platform (on Simulator) and Last (Android).


The android Emulator (not a simulator) have a poor performance and can't emulate OpenGL ES 2.x. I recommend real devices to develop.


You can find many useful informations :



No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...