Added mobile application events, with implementations for iOS and Android

This commit is contained in:
Sam Lantinga 2013-05-18 12:48:50 -07:00
parent 2ff60371f5
commit 2ac8624930
9 changed files with 182 additions and 44 deletions

View file

@ -78,17 +78,26 @@ public class SDLActivity extends Activity {
}
// Events
/*protected void onPause() {
@Override
protected void onPause() {
Log.v("SDL", "onPause()");
super.onPause();
// Don't call SDLActivity.nativePause(); here, it will be called by SDLSurface::surfaceDestroyed
}
@Override
protected void onResume() {
Log.v("SDL", "onResume()");
super.onResume();
// Don't call SDLActivity.nativeResume(); here, it will be called via SDLSurface::surfaceChanged->SDLActivity::startApp
}*/
}
@Override
public void onLowMemory() {
Log.v("SDL", "onLowMemory()");
super.onLowMemory();
SDLActivity.nativeLowMemory();
}
@Override
protected void onDestroy() {
@ -180,6 +189,7 @@ public class SDLActivity extends Activity {
// C functions we call
public static native void nativeInit();
public static native void nativeLowMemory();
public static native void nativeQuit();
public static native void nativePause();
public static native void nativeResume();
@ -600,8 +610,6 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
public void onDraw(Canvas canvas) {}
// Key events
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {