Still trying to get the overlay gamepad
This commit is contained in:
@@ -329,9 +329,9 @@ public class MainActivity extends SDLActivity
|
||||
setContentView(_videoLayout);*/
|
||||
|
||||
|
||||
/*mGLView = new DemoGLSurfaceView(this);
|
||||
mGLView = new DemoGLSurfaceView(this);
|
||||
SetLayerType.get().setLayerType(mGLView);
|
||||
mLayout.addView(mGLView);*/
|
||||
mLayout.addView(mGLView);
|
||||
//mGLView.setFocusableInTouchMode(true);
|
||||
//mGLView.setFocusable(true);
|
||||
//mGLView.requestFocus();
|
||||
@@ -474,7 +474,7 @@ public class MainActivity extends SDLActivity
|
||||
if (sendBackspace && event.getAction() == KeyEvent.ACTION_UP)
|
||||
{
|
||||
synchronized(textInput) {
|
||||
DemoRenderer.nativeTextInput( 8, 0 ); // Send backspace to native code
|
||||
//DemoRenderer.nativeTextInput( 8, 0 ); // Send backspace to native code
|
||||
}
|
||||
}
|
||||
// EditText deletes two characters at a time, here's a hacky fix
|
||||
@@ -562,12 +562,12 @@ public class MainActivity extends SDLActivity
|
||||
synchronized(textInput)
|
||||
{
|
||||
String text = _screenKeyboard.getText().toString();
|
||||
for(int i = 0; i < text.length(); i++)
|
||||
/*for(int i = 0; i < text.length(); i++)
|
||||
{
|
||||
DemoRenderer.nativeTextInput( (int)text.charAt(i), (int)text.codePointAt(i) );
|
||||
}
|
||||
}*/
|
||||
}
|
||||
DemoRenderer.nativeTextInputFinished();
|
||||
//DemoRenderer.nativeTextInputFinished();
|
||||
_inputManager.hideSoftInputFromWindow(_screenKeyboard.getWindowToken(), 0);
|
||||
mLayout.removeView(_screenKeyboard);
|
||||
_screenKeyboard = null;
|
||||
@@ -689,14 +689,14 @@ public class MainActivity extends SDLActivity
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, final KeyEvent event)
|
||||
{
|
||||
/*if(_screenKeyboard != null)
|
||||
if(_screenKeyboard != null)
|
||||
_screenKeyboard.onKeyDown(keyCode, event);
|
||||
else
|
||||
if( mGLView != null )
|
||||
{
|
||||
if( mGLView.nativeKey( keyCode, 1 ) == 0 )
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}*/
|
||||
}
|
||||
/*
|
||||
else
|
||||
if( keyCode == KeyEvent.KEYCODE_BACK && downloader != null )
|
||||
@@ -707,11 +707,11 @@ public class MainActivity extends SDLActivity
|
||||
onStop();
|
||||
}
|
||||
*/
|
||||
/*else
|
||||
else
|
||||
if( keyListener != null )
|
||||
{
|
||||
keyListener.onKeyEvent(keyCode);
|
||||
}*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -454,8 +454,8 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceCreated(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart );
|
||||
mGlSurfaceCreated = true;
|
||||
mGl = gl;
|
||||
if( ! mPaused && ! mFirstTimeStart )
|
||||
nativeGlContextRecreated();
|
||||
/*if( ! mPaused && ! mFirstTimeStart )
|
||||
nativeGlContextRecreated();*/
|
||||
mFirstTimeStart = false;
|
||||
}
|
||||
|
||||
@@ -471,14 +471,14 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
mGl = gl;
|
||||
nativeResize(w, h, Globals.KeepAspectRatio ? 1 : 0);
|
||||
//nativeResize(w, h, Globals.KeepAspectRatio ? 1 : 0);
|
||||
}
|
||||
|
||||
public void onSurfaceDestroyed() {
|
||||
Log.i("SDL", "libSDL: DemoRenderer.onSurfaceDestroyed(): paused " + mPaused + " mFirstTimeStart " + mFirstTimeStart );
|
||||
mGlSurfaceCreated = false;
|
||||
mGlContextLost = true;
|
||||
nativeGlContextLost();
|
||||
//nativeGlContextLost();
|
||||
};
|
||||
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
@@ -487,7 +487,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
DrawLogo(mGl);
|
||||
SwapBuffers();
|
||||
|
||||
nativeInitJavaCallbacks();
|
||||
//nativeInitJavaCallbacks();
|
||||
|
||||
// Make main thread priority lower so audio thread won't get underrun
|
||||
// Thread.currentThread().setPriority((Thread.currentThread().getPriority() + Thread.MIN_PRIORITY)/2);
|
||||
@@ -503,10 +503,10 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
if(Globals.AudioBufferConfig >= 2)
|
||||
Thread.currentThread().setPriority( (Thread.NORM_PRIORITY + Thread.MIN_PRIORITY) / 2 ); // Lower than normal
|
||||
// Calls main() and never returns, hehe - we'll call eglSwapBuffers() from native code
|
||||
nativeInit( Globals.DataDir,
|
||||
/*nativeInit( Globals.DataDir,
|
||||
Globals.CommandLine,
|
||||
( (Globals.SwVideoMode && Globals.MultiThreadedVideo) || Globals.CompatibilityHacksVideo ) ? 1 : 0,
|
||||
android.os.Debug.isDebuggerConnected() ? 1 : 0 );
|
||||
android.os.Debug.isDebuggerConnected() ? 1 : 0 );*/
|
||||
System.exit(0); // The main() returns here - I don't bother with deinit stuff, just terminate process
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
|
||||
public void exitApp()
|
||||
{
|
||||
nativeDone();
|
||||
//nativeDone();
|
||||
}
|
||||
|
||||
public void getAdvertisementParams(int params[])
|
||||
@@ -702,15 +702,15 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
}
|
||||
|
||||
|
||||
private native void nativeInitJavaCallbacks();
|
||||
private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int isDebuggerConnected);
|
||||
private native void nativeResize(int w, int h, int keepAspectRatio);
|
||||
private native void nativeDone();
|
||||
private native void nativeGlContextLost();
|
||||
public native void nativeGlContextRecreated();
|
||||
public native void nativeGlContextLostAsyncEvent();
|
||||
public static native void nativeTextInput( int ascii, int unicode );
|
||||
public static native void nativeTextInputFinished();
|
||||
//private native void nativeInitJavaCallbacks();
|
||||
//private native void nativeInit(String CurrentPath, String CommandLine, int multiThreadedVideo, int isDebuggerConnected);
|
||||
//private native void nativeResize(int w, int h, int keepAspectRatio);
|
||||
//private native void nativeDone();
|
||||
//private native void nativeGlContextLost();
|
||||
//public native void nativeGlContextRecreated();
|
||||
//public native void nativeGlContextLostAsyncEvent();
|
||||
//public static native void nativeTextInput( int ascii, int unicode );
|
||||
//public static native void nativeTextInputFinished();
|
||||
|
||||
private MainActivity context = null;
|
||||
public AccelerometerReader accelerometer = null;
|
||||
@@ -788,7 +788,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
if(mRenderer.mPaused)
|
||||
return;
|
||||
mRenderer.mPaused = true;
|
||||
mRenderer.nativeGlContextLostAsyncEvent();
|
||||
//mRenderer.nativeGlContextLostAsyncEvent();
|
||||
if( mRenderer.accelerometer != null ) // For some reason it crashes here often - are we getting this event before initialization?
|
||||
mRenderer.accelerometer.stop();
|
||||
super.onPause();
|
||||
@@ -805,8 +805,8 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
mRenderer.mPaused = false;
|
||||
super.onResume();
|
||||
Log.i("SDL", "libSDL: DemoGLSurfaceView.onResume(): mRenderer.mGlSurfaceCreated " + mRenderer.mGlSurfaceCreated + " mRenderer.mPaused " + mRenderer.mPaused);
|
||||
if( mRenderer.mGlSurfaceCreated && ! mRenderer.mPaused || Globals.NonBlockingSwapBuffers )
|
||||
mRenderer.nativeGlContextRecreated();
|
||||
/*if( mRenderer.mGlSurfaceCreated && ! mRenderer.mPaused || Globals.NonBlockingSwapBuffers )
|
||||
mRenderer.nativeGlContextRecreated();*/
|
||||
if( mRenderer.accelerometer != null && mRenderer.accelerometer.openedBySDL ) // For some reason it crashes here often - are we getting this event before initialization?
|
||||
mRenderer.accelerometer.start();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user