Update SDL version

This commit is contained in:
Joshua Granick
2015-09-14 13:56:34 -07:00
parent 839dfad281
commit c4d05afb40
2 changed files with 50 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.media.*;
import android.hardware.*;
import android.content.pm.ActivityInfo;
import org.haxe.HXCPP;
@@ -1067,6 +1068,42 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
SDLActivity.onNativeResize(width, height, sdlFormat, mDisplay.getRefreshRate());
Log.v("SDL", "Window size: " + width + "x" + height);
boolean skip = false;
int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation();
if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
{
// Accept any
}
else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
{
if (mWidth > mHeight) {
skip = true;
}
} else if (requestedOrientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
if (mWidth < mHeight) {
skip = true;
}
}
// Special Patch for Square Resolution: Black Berry Passport
if (skip) {
double min = Math.min(mWidth, mHeight);
double max = Math.max(mWidth, mHeight);
if (max / min < 1.20) {
Log.v("SDL", "Don't skip on such aspect-ratio. Could be a square resolution.");
skip = false;
}
}
if (skip) {
Log.v("SDL", "Skip .. Surface is not ready.");
return;
}
// Set mIsSurfaceReady to 'true' *before* making a call to handleResume
SDLActivity.mIsSurfaceReady = true;
SDLActivity.onNativeSurfaceChanged();
@@ -1098,6 +1135,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}, "SDLThreadListener");
SDLActivity.mSDLThread.start();
}
if (SDLActivity.mHasFocus) {
SDLActivity.handleResume();
}
}
// unused
@@ -1465,7 +1506,13 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
if (joystick == null) {
joystick = new SDLJoystick();
InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]);
if( (joystickDevice.getSources() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
if (
(joystickDevice.getSources() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0
||
(joystickDevice.getSources() & InputDevice.SOURCE_CLASS_BUTTON) != 0
)
{
joystick.device_id = deviceIds[i];
joystick.name = joystickDevice.getName();
joystick.axes = new ArrayList<InputDevice.MotionRange>();
@@ -1561,7 +1608,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
@Override
public boolean onGenericMotion(View v, MotionEvent event) {
float x, y;
int mouseButton;
int action;
switch ( event.getSource() ) {
@@ -1590,6 +1636,7 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
default:
break;
}
break;
default:
break;