mirror of https://github.com/encounter/SDL.git
Added an option to define libraries to be loaded on Android in a derived class.
This way it is no more needed to modify SDLActivity.java to add own libraries.
This commit is contained in:
parent
775a802627
commit
bc382e390a
|
@ -54,9 +54,16 @@ public class SDLActivity extends Activity {
|
||||||
// Audio
|
// Audio
|
||||||
protected static AudioTrack mAudioTrack;
|
protected static AudioTrack mAudioTrack;
|
||||||
|
|
||||||
// Load the .so
|
/**
|
||||||
public void loadLibraries() {
|
* This method is called by SDL before loading the native shared libraries.
|
||||||
String AppLibraries[] = {
|
* It can be overridden to provide names of shared libraries to be loaded.
|
||||||
|
* The default implementation returns the defaults. It never returns null.
|
||||||
|
* An array returned by a new implementation must at least contain "SDL2".
|
||||||
|
* Also keep in mind that the order the libraries are loaded may matter.
|
||||||
|
* @return names of shared libraries to be loaded (e.g. "SDL2", "main").
|
||||||
|
*/
|
||||||
|
protected String[] getLibraries() {
|
||||||
|
return new String[] {
|
||||||
"SDL2",
|
"SDL2",
|
||||||
// "SDL2_image",
|
// "SDL2_image",
|
||||||
// "SDL2_mixer",
|
// "SDL2_mixer",
|
||||||
|
@ -64,8 +71,11 @@ public class SDLActivity extends Activity {
|
||||||
// "SDL2_ttf",
|
// "SDL2_ttf",
|
||||||
"main"
|
"main"
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
for (String lib : AppLibraries) {
|
// Load the .so
|
||||||
|
public void loadLibraries() {
|
||||||
|
for (String lib : getLibraries()) {
|
||||||
System.loadLibrary(lib);
|
System.loadLibrary(lib);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue