Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting an SDL 2.0 game to Android

I have a game written in C/C++ with SDL 2.0, I would like to port it to mobile platforms (specifically Android and maybe other platforms too). I read SDL has a native support for Android but the game itself is written for Windows at first, although no Windows-dependent libraries/code were used. As for Android, I only used the Java based SDK before and never integrated it with native code. Which changes (if any) do I have to make to the C/C++ so I could use it on Android platform? How exactly do I acually compile the whole thing to an APK? Is it possible to use Java and C/C++ for the application, I mean, the game's activity will be the native one but the other activities (menus, settings, etc) can be written with the regular Android Java SDK?

like image 683
UnTraDe Avatar asked Jul 12 '14 13:07

UnTraDe


1 Answers

The Android README file in the SDL source release outlines most of what you need to know with regards to porting your SDL App to Android. There's also an example project for Eclipse that demonstrates you can modify to suit your needs.

https://hg.libsdl.org/SDL/file/d6a8fa507a45/README-android.txt

The iOS README file is also useful, namely for the sections on events and input, as much of it carries over to the Android port.

https://hg.libsdl.org/SDL/file/d6a8fa507a45/README-ios.txt

If you need help setting up the build environment, check out this (brief) tutorial which covers installing the ADK and NDK, SDL source, building a project, programming for Android and interfacing with Java.

http://www.dinomage.com/2013/01/howto-sdl-on-android/

http://www.dinomage.com/2013/05/howto-sdl-on-android-part-2-platform-details/

like image 62
nick.amor Avatar answered Oct 02 '22 23:10

nick.amor