project_files/Android-build/SDL-android-project/src/org/hedgewars/mobile/SDLActivity.java
equal
deleted
inserted
replaced
6 import javax.microedition.khronos.egl.EGLDisplay; |
6 import javax.microedition.khronos.egl.EGLDisplay; |
7 import javax.microedition.khronos.egl.EGLSurface; |
7 import javax.microedition.khronos.egl.EGLSurface; |
8 |
8 |
9 import org.hedgewars.mobile.EngineProtocol.EngineProtocolNetwork; |
9 import org.hedgewars.mobile.EngineProtocol.EngineProtocolNetwork; |
10 import org.hedgewars.mobile.EngineProtocol.GameConfig; |
10 import org.hedgewars.mobile.EngineProtocol.GameConfig; |
|
11 import org.hedgewars.mobile.EngineProtocol.PascalExports; |
11 import org.hedgewars.mobile.TouchInterface.TouchInterface; |
12 import org.hedgewars.mobile.TouchInterface.TouchInterface; |
12 |
13 |
13 import android.app.Activity; |
14 import android.app.Activity; |
14 import android.content.Context; |
15 import android.content.Context; |
15 import android.graphics.Canvas; |
16 import android.graphics.Canvas; |
344 // Called when we lose the surface |
345 // Called when we lose the surface |
345 public void surfaceDestroyed(SurfaceHolder holder) { |
346 public void surfaceDestroyed(SurfaceHolder holder) { |
346 Log.v("SDL", "surfaceDestroyed()"); |
347 Log.v("SDL", "surfaceDestroyed()"); |
347 |
348 |
348 // Send a quit message to the application |
349 // Send a quit message to the application |
349 SDLActivity.nativeQuit(); |
350 //SDLActivity.nativeQuit(); |
|
351 PascalExports.HWterminate(true); |
350 |
352 |
351 // Now wait for the SDL thread to quit |
353 // Now wait for the SDL thread to quit |
352 if (mSDLThread != null) { |
354 if (mSDLThread != null) { |
353 try { |
355 try { |
354 mSDLThread.join(); |
356 mSDLThread.join(); |
518 public boolean onKey(View v, int keyCode, KeyEvent event) { |
520 public boolean onKey(View v, int keyCode, KeyEvent event) { |
519 if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) return false; |
521 if(keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) return false; |
520 if (event.getAction() == KeyEvent.ACTION_DOWN) { |
522 if (event.getAction() == KeyEvent.ACTION_DOWN) { |
521 Log.v("SDL", "key down: " + keyCode); |
523 Log.v("SDL", "key down: " + keyCode); |
522 if(keyCode == KeyEvent.KEYCODE_BACK){//TODO ask user to quit or not |
524 if(keyCode == KeyEvent.KEYCODE_BACK){//TODO ask user to quit or not |
523 SDLActivity.nativeQuit(); |
525 PascalExports.HWterminate(true); |
524 //SDLActivity.mSingleton.finish(); |
526 //SDLActivity.mSingleton.finish(); |
525 }else{ |
527 }else{ |
526 SDLActivity.onNativeKeyDown(keyCode); |
528 SDLActivity.onNativeKeyDown(keyCode); |
527 } |
529 } |
528 |
530 |