diff --git a/project/java/Settings.java b/project/java/Settings.java index e978676cb..a2c40f789 100644 --- a/project/java/Settings.java +++ b/project/java/Settings.java @@ -1185,34 +1185,61 @@ class Settings } void run (final MainActivity p) { - CharSequence[] items = { p.getResources().getString(R.string.display_size_large), + CharSequence[] items = { + p.getResources().getString(R.string.display_size_tiny_touchpad), + p.getResources().getString(R.string.display_size_tiny), p.getResources().getString(R.string.display_size_small), p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.display_size_tiny), - p.getResources().getString(R.string.display_size_tiny_touchpad), }; + p.getResources().getString(R.string.display_size_large), + }; + int _size_tiny_touchpad = 0; + int _size_tiny = 1; + int _size_small = 2; + int _size_small_touchpad = 3; + int _size_large = 4; + int _more_options = 5; + if( ! Globals.SwVideoMode ) { - CharSequence[] items2 = { p.getResources().getString(R.string.display_size_large), - p.getResources().getString(R.string.display_size_small_touchpad), }; + CharSequence[] items2 = { + p.getResources().getString(R.string.display_size_small_touchpad), + p.getResources().getString(R.string.display_size_large), + }; items = items2; + _size_small_touchpad = 0; + _size_large = 1; + _size_tiny_touchpad = _size_tiny = _size_small = 1000; + } if( firstStart ) { - CharSequence[] items2 = { p.getResources().getString(R.string.display_size_large), + CharSequence[] items2 = { + p.getResources().getString(R.string.display_size_tiny_touchpad), + p.getResources().getString(R.string.display_size_tiny), p.getResources().getString(R.string.display_size_small), p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.display_size_tiny), - p.getResources().getString(R.string.display_size_tiny_touchpad), - p.getResources().getString(R.string.show_more_options), }; + p.getResources().getString(R.string.display_size_large), + p.getResources().getString(R.string.show_more_options), + }; items = items2; if( ! Globals.SwVideoMode ) { - CharSequence[] items3 = { p.getResources().getString(R.string.display_size_large), + CharSequence[] items3 = { p.getResources().getString(R.string.display_size_small_touchpad), - p.getResources().getString(R.string.show_more_options), }; + p.getResources().getString(R.string.display_size_large), + p.getResources().getString(R.string.show_more_options), + }; items = items3; + _more_options = 3; } } + // Java is so damn worse than C++11 + final int size_tiny_touchpad = _size_tiny_touchpad; + final int size_tiny = _size_tiny; + final int size_small = _size_small; + final int size_small_touchpad = _size_small_touchpad; + final int size_large = _size_large; + final int more_options = _more_options; AlertDialog.Builder builder = new AlertDialog.Builder(p); builder.setTitle(R.string.display_size); @@ -1221,47 +1248,37 @@ class Settings public void onClick(DialogInterface dialog, int item) { dialog.dismiss(); - if( item == 0 ) + if( item == size_large ) { Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; Globals.RelativeMouseMovement = false; Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; } - if( item == 1 ) + if( item == size_small ) { - if( Globals.SwVideoMode ) - { - Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; - Globals.RelativeMouseMovement = false; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_MAGNIFIER; - } - else - { - // OpenGL does not support magnifying glass - Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; - Globals.RelativeMouseMovement = true; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; - } + Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; + Globals.RelativeMouseMovement = false; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_MAGNIFIER; } - if( item == 2 && Globals.SwVideoMode ) + if( item == size_small_touchpad ) { Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; Globals.RelativeMouseMovement = true; Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE; } - if( item == 3 ) + if( item == size_tiny ) { Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR; Globals.RelativeMouseMovement = false; - Globals.ShowScreenUnderFinger = Mouse.ZOOM_WHOLE_SCREEN; + Globals.ShowScreenUnderFinger = Mouse.ZOOM_SCREEN_TRANSFORM; } - if( item == 4 ) + if( item == size_tiny_touchpad ) { Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT; Globals.RelativeMouseMovement = true; Globals.ShowScreenUnderFinger = Mouse.ZOOM_FULLSCREEN_MAGNIFIER; } - if( firstStart && ( item == 5 || ( ! Globals.SwVideoMode && item == 2 ) ) ) + if( item == more_options ) { menuStack.clear(); new MainMenu().run(p); @@ -1270,8 +1287,8 @@ class Settings goBack(p); } } - if( firstStart ) - builder.setItems(items, new ClickListener()); + builder.setItems(items, new ClickListener()); + /* else builder.setSingleChoiceItems(items, Globals.ShowScreenUnderFinger == Mouse.ZOOM_NONE ? @@ -1279,6 +1296,7 @@ class Settings ( Globals.ShowScreenUnderFinger == Mouse.ZOOM_MAGNIFIER && Globals.SwVideoMode ) ? 1 : Globals.ShowScreenUnderFinger + 1, new ClickListener()); + */ builder.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) diff --git a/project/java/Video.java b/project/java/Video.java index 60c1b0dd1..d3f700974 100644 --- a/project/java/Video.java +++ b/project/java/Video.java @@ -81,7 +81,7 @@ class Mouse public static final int ZOOM_NONE = 0; public static final int ZOOM_MAGNIFIER = 1; - public static final int ZOOM_WHOLE_SCREEN = 2; + public static final int ZOOM_SCREEN_TRANSFORM = 2; public static final int ZOOM_FULLSCREEN_MAGNIFIER = 3; } @@ -468,6 +468,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL { { touchInput.process(event); // Wait a bit, and try to synchronize to app framerate, or event thread will eat all CPU and we'll lose FPS + // With Froyo the rate of touch events is limited, but they are arriving faster then we're redrawing anyway if(( event.getAction() == MotionEvent.ACTION_MOVE || event.getAction() == MotionEvent.ACTION_HOVER_MOVE)) { @@ -475,7 +476,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL { { try { - mRenderer.wait(300L); + mRenderer.wait(300L); // And sometimes the app decides not to render at all, so this timeout should not be big. } catch (InterruptedException e) { } } } diff --git a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c index 9f4f1e5c0..848754a32 100644 --- a/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c +++ b/project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c @@ -897,7 +897,7 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects) glPopMatrix(); //glFlush(); } - if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_WHOLE_SCREEN ) + if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_SCREEN_TRANSFORM ) { SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &SDL_ANDROID_ShowScreenUnderFingerRectSrc, &SDL_ANDROID_ShowScreenUnderFingerRect); SDL_Rect edge, edgeSrc; diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c index a6dccaac4..5dd71941d 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c +++ b/project/jni/sdl-1.3/src/video/android/SDL_androidinput.c @@ -195,7 +195,7 @@ void UpdateScreenUnderFingerRect(int x, int y) if( InsideRect(&SDL_ANDROID_ShowScreenUnderFingerRect, x, y) ) SDL_ANDROID_ShowScreenUnderFingerRect.x = x - SDL_ANDROID_ShowScreenUnderFingerRect.w*11/10 - 1; } - if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_WHOLE_SCREEN ) + if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_SCREEN_TRANSFORM ) { SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = screenX / 3; SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = screenY / 3; @@ -648,7 +648,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER ) UpdateScreenUnderFingerRect(x, y); } - if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_WHOLE_SCREEN || + if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_SCREEN_TRANSFORM || SDL_ANDROID_ShowScreenUnderFinger == ZOOM_FULLSCREEN_MAGNIFIER ) UpdateScreenUnderFingerRect(x, y); } diff --git a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h index bc6483057..25473d936 100644 --- a/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h +++ b/project/jni/sdl-1.3/src/video/android/SDL_androidvideo.h @@ -28,7 +28,7 @@ #include "SDL_joystick.h" #include "SDL_events.h" -enum ScreenZoom { ZOOM_NONE = 0, ZOOM_MAGNIFIER = 1, ZOOM_WHOLE_SCREEN = 2, ZOOM_FULLSCREEN_MAGNIFIER = 3 }; +enum ScreenZoom { ZOOM_NONE = 0, ZOOM_MAGNIFIER = 1, ZOOM_SCREEN_TRANSFORM = 2, ZOOM_FULLSCREEN_MAGNIFIER = 3 }; extern int SDL_ANDROID_sWindowWidth; extern int SDL_ANDROID_sWindowHeight;