I was looking for a way to build the Xerces-C++ library for Android that I need as a dependency of Delta3D game engine, but could not find any information on this. I would very much appreciate a professional advice.
You can copy xercesc library with Android build scripts from here.
Just copy it into your jni folder and run ndk-build.
Most Android development is done in Java. The Delta3D game engine is in C++, which means you'll need to start with the Android Native Development Kit (NDK). The FAQ claims that the library uses cross-platform dependencies, so, in theory you should be able to use it on Android. However, it is written for OpenGL, not OpenGL ES, which is the subset used in Android. This could cause an issue. The other concern would be memory footprint. There is a fair amount of work that will probably need to be done to get this to compile under Android. You might consider working with a library which has already been ported to Android (or written for it) rather than all the work that will be needed to port this, let alone writing your game. Unless, you already have a game written in this game engine, which I understand why you would want to just port the library over.
Related
I need a C++ library that runs on Android and iOS which can be used to create PDF documents.
So far I have found libHaru:
libHaru is a free, cross platform, open source library for generating PDF files.
The library seems fine and I already found a working example on how to use it with iOS.
But I would like to have a library less "low level", because in libHaru you have to manually create new pages, line breaks etc. So the question is if someone can advice me any C++ library which can run on Android and iOS and is a little bit more high level.
As a bonus: It would be great, if that library is also free (as in freedom) or at least free to use.
Edit: I have tried Qt and it is rather clumsy to use in such an early development stage (regarding iOS and Android development). I would appreciate a stable library with good documentation provided.
You can use Qt for that. The class you would be looking for is QPdfWriter The nice thing about it is, that as you draw onto that thingy, you can replace the QPdfWriter with different kinds of QPaintDevices, like QWidget or QImage and so forth. It's very generic and high level, but Qt is also quite big.
I recently know that we can use Android NDK (use C++ language) to program. But, I'm afraid that, can we use Android NDK to do most of work in Android ? (because people just say that NDK just helps increasing performance of an android program)
I see that ADT plugin for eclipse is powerful, but It's for java. So, if I want to develop on Android NDK, does it has a plugin same with that.
thanks :)
Java is well-supported on Android: there are books, tutorials, Google results and a lot of similar documentation and resources. Developing with the NDK has less stuff available.
Although you can in principle write your full application in C++ using the NativeActivity, I believe that you will have less resources at your disposal for that, compared to Java. If you really want to make your Java program faster, you should profile it, to find which part needs this performance gain and write only that part in C++ using JNI.
you could, but it is not recommend. For one c++ and java performance for multiple aspects are equivalent, then every jni call has its overhead that you have to take in account. Take a look to this link
I've been working on a game engine runtime environment in C++ for my future games, and have started to consider android as a platform. I noticed that it was tightly bound to Java and uses Java VMs heavily.
But is it possible to sustain a full C++ runtime environment in Android NDK? I have nothing against Java and am prepared to use it if I have to, but performance is one of my prime concerns (I intend for my games to be resource-intensive), especially on phones.
And if a full C++ environment is possible, how exactly would I implement it in Eclipse Indigo CDT? Would I be able to create a compiled game executable for Android ahead of time for maximum performance? And would there be any additional plugins I'd need to install in Eclipse? Could I use MinGW for compiling my games, or would I need to use a different compiler? If I had to use Java in one way or another, would compilation of the C++ code even be required? These are all questions I'd like to answer to get a sturdy development environment going in the Eclipse IDE.
Please know that I'm still fairly new to Android development, and multiplatform programming in general. My goal is to create a game engine that'll take the most advantage of the new hardware out there, especially on phones!
Thanks for any advice you guys can give!
NativeActivity, added in Android 2.3 (API 9) might be what you're looking for in terms of writing Android games using only C++. http://developer.android.com/reference/android/app/NativeActivity.html
However since you say you're new to this you may want to start with one of the currently available Android game engines instead of writing your own right away. Mobile devices have a very different set of constraints than other platforms. A phone isn't very useful if the battery dies mid-afternoon, so starting a project with the stated goal of being "resource-intensive" is already getting off to a bad start. Few people will want to play your games for 20 minutes here and there if it means they won't be able to make a phone call in the evening.
If what you meant is that you are shooting for high-end graphics, keep in mind that devices have a wide range of capability in this area and targeting only the high end limits your audience. Different GPUs have very different strategies and performance characteristics and all have cases where they shine or lag behind. The most successful mobile games aren't the ones with the highest polycounts or the most complex lighting shaders, they're the games that achieve a consistently smooth framerate and have a distinctive style.
Have a look at some of the existing game engines for Android and try them out. Write a couple small games to take them for a test drive and see where they do and don't mesh with what you're trying to do. If you find yourself feeling limited with what's available, take what you've learned and try to write your own engine that fits with the types of games you want to make.
Here are some links to get you started. These engines power some very popular games on Android Market and many developers have found them useful:
http://www.andengine.org/ andengine is written in Java and is open source.
http://unity3d.com/ Unity is based on C# and Mono.
http://www.madewithmarmalade.com/ Marmalade, formerly Airplay SDK is based on C++.
The answer you want to pay close attention to is #adamp's. Ignore his answer at your own peril.
To address a couple of other points in your question, though:
Would I be able to create a compiled game executable for Android ahead of time for maximum performance?
No, insofar as Android does not use "compiled game executables". Your C/C++ code will be compiled into a Linux shared object (.so) file and packaged with other stuff (like your manifest) in an APK file. Compiling the .so will be ahead of time, though.
Could I use MinGW for compiling my games would I need to use a different compiler?
I get the distinct impression that you will claw your eyes out trying to do NDK development in Cygwin on Windows. I heartily encourage you to do your NDK development on OS X or Linux. At least set up a VirtualBox with Ubuntu or something in it to do your NDK compiles.
Regardless, the NDK comes with its own GCC compiler. AFAIK, MinGW is not a cross-compiler, and most Android devices are not running on x86 CPUs.
If I had to use Java in one way or another, would compilation of the C++ code even be required?
Yes. Now, for Honeycomb, you have the option of using Renderscript for OpenGL work -- that amounts to a C99 environment whose code you will not need to compile with the NDK.
I've tried a bunch of them, and one of the best I found that cross compiles instantly to a bunch of other devices and let's you program your goodies in HTML5/C++ combo (sweeeeet) is MoSync (http://www.mosync.com/) and another little known one that is a little more setup friendly is MotoDev by Motorola (http://developer.motorola.com/tools/motodevstudio/?utm_campaign=mhp01092012&utm_source=mhp&utm_medium=mws)
I've noticed there is some virtual machine images and tutorials you can use to prevent the setting up hassle.
In order for reuse ability on iOS, I would like to write the logic for my Android game in C++ rather than java. How can I create a C++ class in eclipse and integrate it into my application?
I have read "native C++ code can be used on Android as well using the Native Development Kit (NDK)". What is the latest and greatest way to do this? I am writing a simple OpenGL app? Are there any tutorials out there that people have found useful?
Thanks very much.
Investigate using the JNI and NDK here:
http://developer.android.com/sdk/ndk/index.html
I have written a multi platform 2D engine that runs on a fair amount of platforms. It's possible to do though not relatively easy to implement.
The way I did it was split it up in 2 parts where I used Java for the Activity lifecycle and some additional assist functionality and library encapsulated C++ code for all the rest.
For the C++ I used the JNI where I had two shared libraries. One library held the core logic that ran the entire game and then the other library was a sort of passthrough library with a couple of methods that were called from Java. This way, I could just recompile the core library on each platform without a lot of difficulties and I could rewrite the UI section for each platform. On iOS, I wrote it in Obj-C, on android in Java and on Windows in C/C++.
I face a problem while developing a native C/C++ shared library for Android platform. As we all know that Android use Java language for the upper layer development. Now I have ported my Engine code using ASCII C/C++ to Android using its bionic library, yet when need to design the User Interface, I have to use the JNI to call my engine code.
As far as I know, that is the only choice. The problem is my engine own hundreds of export APIs. If I use the JNI tech. I need to wrap these APIs to a new shared library for use, which will cost a lot of time for development and testing.
Can somebody give some suggestions for this situation? I am not familiar with java or JNI tech by the way.
TIPS:
When I searched the internet, I found some open source for JNI generator such as JNative etc. Until now I do not know is it suitable for Android platform or not.
You can easily use SWIG www.swig.org which will generate the JNI bindings for you.
there is nothing android-specific in that operation, so it will work rather out-of-the-box.