Integrated Michi's changes to accelerometer joystick and to video aspect ratio
This commit is contained in:
@@ -376,11 +376,11 @@ void updateOrientation ( float accX, float accY, float accZ )
|
||||
|
||||
if( isJoystickUsed && CurrentJoysticks[0] ) // TODO: mutex for that stuff?
|
||||
{
|
||||
// TODO: fix coefficients
|
||||
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 0, (accX - midX) * 1000);
|
||||
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 1, (accY - midY) * 1000);
|
||||
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 2, (accZ - midZ) * 1000);
|
||||
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 0, (Sint16)(fmin(32767, fmax(-32768, (accX - midX) * 400.0))));
|
||||
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 1, (Sint16)(fmin(32767, fmax(-32768, (accY - midY) * 400.0))));
|
||||
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 2, (Sint16)(fmin(32767, fmax(-32768, (accZ - midZ) * 400.0))));
|
||||
|
||||
// TODO: option for fixed/floating center pos
|
||||
if( accY < midY - dy*2 )
|
||||
midY = accY + dy*2;
|
||||
if( accY > midY + dy*2 )
|
||||
@@ -389,9 +389,12 @@ void updateOrientation ( float accX, float accY, float accZ )
|
||||
midZ = accZ + dz*2;
|
||||
if( accZ > midZ + dz*2 )
|
||||
midZ = accZ - dz*2;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(isJoystickUsed)
|
||||
return;
|
||||
|
||||
|
||||
if( accX < midX - dx )
|
||||
{
|
||||
@@ -643,7 +646,7 @@ void SDL_ANDROID_processAndroidTrackballDampening()
|
||||
int SDL_SYS_JoystickInit(void)
|
||||
{
|
||||
SDL_numjoysticks = MAX_MULTITOUCH_POINTERS+1;
|
||||
return(0);
|
||||
return(SDL_numjoysticks);
|
||||
}
|
||||
|
||||
/* Function to get the device-dependent name of a joystick */
|
||||
|
||||
@@ -94,8 +94,19 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint
|
||||
{
|
||||
if( SDL_ANDROID_sWindowWidth == 0 )
|
||||
{
|
||||
#if SDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT
|
||||
// TODO: tweak that parameters when app calls SetVideoMode(), not here - app may request something else than 640x480, it's okay for most apps though
|
||||
// Also this should be user-configurable setting, not compiler option
|
||||
SDL_ANDROID_sWindowWidth = (SDL_ANDROID_sFakeWindowWidth*h)/SDL_ANDROID_sFakeWindowHeight;
|
||||
SDL_ANDROID_sWindowHeight = h;
|
||||
if(SDL_ANDROID_sWindowWidth > w) {
|
||||
SDL_ANDROID_sWindowWidth = w;
|
||||
SDL_ANDROID_sWindowHeight = (SDL_ANDROID_sFakeWindowHeight*w)/SDL_ANDROID_sFakeWindowWidth;
|
||||
}
|
||||
#else
|
||||
SDL_ANDROID_sWindowWidth = w;
|
||||
SDL_ANDROID_sWindowHeight = h;
|
||||
#endif
|
||||
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d", w, h);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user