Random changes here and there, preparation to make libSDL aware of Menu key - this won't work yet!

This commit is contained in:
pelya
2010-09-03 18:42:10 +03:00
parent 59e15688fc
commit 84b7ba606d
20 changed files with 62 additions and 38 deletions

View File

@@ -18,7 +18,7 @@
fixed with a hammer and rasp to work with libSDL port */
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.teeworlds;
import java.io.Writer;
import java.util.ArrayList;
@@ -749,6 +749,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
* @param configSpec
*/
public void start(){
Log.v("SDL", "GLSurfaceView_SDL::EglHelper::start(): creating GL context");
/*
* Get an EGL instance
*/
@@ -781,6 +783,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
* OpenGL interface that renders to that surface.
*/
public GL createSurface(SurfaceHolder holder) {
Log.v("SDL", "GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context");
/*
* The window size has changed, so we need to create a new
* surface.
@@ -835,6 +838,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
}
public void finish() {
Log.v("SDL", "GLSurfaceView_SDL::EglHelper::finish(): destroying GL context");
if (mEglSurface != null) {
mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
EGL10.EGL_NO_SURFACE,
@@ -929,6 +933,8 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
/*
* Update the asynchronous state (window size)
*/
while(true) { // Loop until we're re-created GL context and successfully called swap()
int w, h;
boolean changed;
synchronized (this) {
@@ -941,6 +947,7 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
mNeedStart = true;
}
while (needToWait()) {
//Log.v("SDL", "GLSurfaceView_SDL::run(): paused");
wait();
}
if (mDone) {
@@ -974,7 +981,12 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
* Once we're done with GL, we need to call swapBuffers()
* to instruct the system to display the rendered frame
*/
return mEglHelper.swap();
if( mEglHelper.swap() )
return true;
// We've lost GL context - recreate it
mEglHelper.finish();
mNeedStart = true;
}
} catch (java.lang.InterruptedException e) {
return false;
@@ -1037,12 +1049,14 @@ public class GLSurfaceView_SDL extends SurfaceView implements SurfaceHolder.Call
}
public void onPause() {
Log.v("SDL", "GLSurfaceView_SDL::onPause()");
synchronized (this) {
mPaused = true;
}
}
public void onResume() {
Log.v("SDL", "GLSurfaceView_SDL::onResume()");
synchronized (this) {
mPaused = false;
notify();