mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-11-27 12:00:35 +00:00
Add createSDLMainRunnable() to SDLActivity (thanks Cole!)
This patch adds a new createSDLMainRunnable() method to SDLActivity. Currently, SDL on Android expects to find SDL_main somewhere in native code. When using SDL in a Xamarin application, however, what we really want to do is write our entrypoint in managed code. The easiest way to do this is to allow subclasses of SDLActivity to provide their own Runnable to the SDL thread, as in the attached patch. Fixes https://github.com/libsdl-org/SDL/issues/2785
This commit is contained in:
parent
b9784feb24
commit
3a482ebae0
@ -238,6 +238,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
return mMotionListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method creates a Runnable which invokes SDL_main. The default implementation
|
||||
* uses the getMainSharedObject() and getMainFunction() methods to invoke native
|
||||
* code from the specified shared library.
|
||||
*/
|
||||
protected Runnable createSDLMainRunnable() {
|
||||
return new SDLMain();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the name of the shared object with the application entry point
|
||||
* It can be overridden by derived classes.
|
||||
@ -783,7 +792,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
// Start up the C app thread and enable sensor input for the first time
|
||||
// FIXME: Why aren't we enabling sensor input at start?
|
||||
|
||||
mSDLThread = new Thread(new SDLMain(), "SDLThread");
|
||||
mSDLThread = new Thread(SDLActivity.mSingleton.createSDLMainRunnable(), "SDLThread");
|
||||
mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true);
|
||||
mSDLThread.start();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user