XashActivity: revert 59411a2
This commit is contained in:
parent
b9028879fb
commit
d5d3c6868e
1 changed files with 25 additions and 25 deletions
|
@ -1082,6 +1082,9 @@ class EngineSurface extends SurfaceView implements SurfaceHolder.Callback, View.
|
||||||
private EGLDisplay mEGLDisplay;
|
private EGLDisplay mEGLDisplay;
|
||||||
private EGL10 mEGL;
|
private EGL10 mEGL;
|
||||||
private EGLConfig mEGLConfig;
|
private EGLConfig mEGLConfig;
|
||||||
|
private boolean resizing = false;
|
||||||
|
|
||||||
|
// Sensors
|
||||||
|
|
||||||
// Startup
|
// Startup
|
||||||
public EngineSurface( Context context )
|
public EngineSurface( Context context )
|
||||||
|
@ -1124,47 +1127,44 @@ class EngineSurface extends SurfaceView implements SurfaceHolder.Callback, View.
|
||||||
XashActivity.nativeSetPause(1);
|
XashActivity.nativeSetPause(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean resizing = false;
|
|
||||||
|
|
||||||
// Called when the surface is resized
|
// Called when the surface is resized
|
||||||
public void surfaceChanged( SurfaceHolder holder, int format, int width, int height )
|
public void surfaceChanged( SurfaceHolder holder, int format, int width, int height )
|
||||||
{
|
{
|
||||||
Log.v( TAG, "surfaceChanged()" );
|
Log.v( TAG, "surfaceChanged()" );
|
||||||
int newWidth = 0, newHeight = 0;
|
if( ( XashActivity.mForceHeight!= 0 && XashActivity.mForceWidth!= 0 || XashActivity.mScale != 0 ) && !resizing )
|
||||||
|
{
|
||||||
|
int newWidth, newHeight;
|
||||||
|
resizing = true;
|
||||||
if( XashActivity.mForceHeight != 0 && XashActivity.mForceWidth != 0 )
|
if( XashActivity.mForceHeight != 0 && XashActivity.mForceWidth != 0 )
|
||||||
{
|
{
|
||||||
newWidth = XashActivity.mForceWidth;
|
newWidth = XashActivity.mForceWidth;
|
||||||
newHeight = XashActivity.mForceHeight;
|
newHeight = XashActivity.mForceHeight;
|
||||||
XashActivity.mTouchScaleX = (float)newWidth / width;
|
|
||||||
XashActivity.mTouchScaleY = (float)newHeight / height;
|
|
||||||
holder.setFixedSize( newWidth, newHeight );
|
|
||||||
}
|
|
||||||
else if( XashActivity.mScale != 0 )
|
|
||||||
{
|
|
||||||
newWidth = ( int )( width / XashActivity.mScale );
|
|
||||||
newHeight = ( int )( height / XashActivity.mScale );
|
|
||||||
XashActivity.mTouchScaleX = XashActivity.mTouchScaleY = 1 / XashActivity.mScale;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newWidth = width;
|
newWidth = ( int )( getWidth() / XashActivity.mScale );
|
||||||
newWidth = height;
|
newHeight = ( int )( getHeight() / XashActivity.mScale );
|
||||||
XashActivity.mTouchScaleX = XashActivity.mTouchScaleY = 1.0f;
|
}
|
||||||
|
holder.setFixedSize( newWidth, newHeight );
|
||||||
|
XashActivity.mTouchScaleX = ( float )newWidth / getWidth();
|
||||||
|
XashActivity.mTouchScaleY = ( float )newHeight / getHeight();
|
||||||
|
|
||||||
|
width = newWidth;
|
||||||
|
height = newHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android may force only-landscape app to portait during lock
|
// Android may force only-landscape app to portait during lock
|
||||||
// Just don't notify engine in that case
|
// Just don't notify engine in that case
|
||||||
if( newWidth > newHeight )
|
if( width > height )
|
||||||
XashActivity.onNativeResize( newWidth, newHeight );
|
XashActivity.onNativeResize( width, height );
|
||||||
// holder.setFixedSize( width / 2, height / 2 );
|
// holder.setFixedSize( width / 2, height / 2 );
|
||||||
|
|
||||||
// Now start up the C app thread
|
// Now start up the C app thread
|
||||||
if( mEngThread == null )
|
if( mEngThread == null )
|
||||||
{
|
{
|
||||||
mEngThread = new Thread( new XashMain(), "EngineThread" );
|
mEngThread = new Thread( new XashMain(), "EngineThread" );
|
||||||
mEngThread.start();
|
mEngThread.start();
|
||||||
}
|
}
|
||||||
|
resizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void engineThreadJoin()
|
public void engineThreadJoin()
|
||||||
|
|
Loading…
Add table
Reference in a new issue