The android-project is just a skeleton. You still need to add your own code that uses libSDL, to make it do anything.
So typically you’ll need to add your own application code in jni/src/. Somewhere in there you’ll have a function SDL_main(), which is your application’s entry point. (The equivalent of main() in a normal C program.)
**
The android-project is just a skeleton. You still need to add your own
code that uses libSDL, to make it do anything.
So typically you’ll need to add your own application code in jni/src/.
Somewhere in there you’ll have a function SDL_main(), which is your
application’s entry point. (The equivalent of main() in a normal C program.)
BTW what is the “best” way to do a real app? To change my ID from
org.libsdl.app to org.ggsoft.etw I’ve had to write these wrappers:
I need to add an update to that blog post, in the time since I wrote it, I
found that copying SDLActivity.java from SDL into your own project,
modifying it so it loads the additional libraries you need in the "static"
segment (which is something you can’t override in practice, as far as I
tested), and then inherit your own Activity from org.libsdl.app.SDLActivity
is easier than writing the glue code as I explained there. The glue code
alternative should still be useful if your Activity departs greatly from
the default behaviours found in SDLActivity, such as in the case of a live
wallpaper, but for a regular game or app, inheriting from SDL’s SDLActivity
is the recommended method, at least in my opinion.
This is the approach I took. (My own class inheriting from SDLActivity.)
I tried to make as few changes as possible to SDLActivity. I found I could have my own static{} section in my own class to load the libraries I need, and just load SDL2 from SDLActivity. This tip could be put in the README, and remove the commented out example library loads from SDLActivity.
The only other changes were to make the volume keys work, and changed to a RelativeLayout to make AdMob integration easier.
I still have to merge in changes when I update from hg, but they are minimal.
This is the approach I took. (My own class inheriting from SDLActivity.)
I tried to make as few changes as possible to SDLActivity. I found I could
have my own static{} section in my own class to load the libraries I need,
and just load SDL2 from SDLActivity. This tip could be put in the README,
and remove the commented out example library loads from SDLActivity.
The only other changes were to make the volume keys work, and changed to a
RelativeLayout to make AdMob integration easier.
I still have to merge in changes when I update from hg, but they are
minimal.
Regards,
Philip.
The problem I had with adding my own static section was that I found out
that the base class static version was being run first, and given inter
dependencies I had, I couldn’t load the rest of the libraries I needed in a
separate static block. So, I modify SDLActivity’s static block, it’s a
small change and Mercurial merges it with no problem when changes are
applied to SDLActivity.java–
Gabriel.