Added more screen zoom modes
This commit is contained in:
@@ -87,7 +87,7 @@ class Globals {
|
||||
public static boolean RelativeMouseMovement = ForceRelativeMouseMode; // Laptop touchpad mode
|
||||
public static int RelativeMouseMovementSpeed = 2;
|
||||
public static int RelativeMouseMovementAccel = 0;
|
||||
public static boolean ShowScreenUnderFinger = false;
|
||||
public static int ShowScreenUnderFinger = Mouse.ZOOM_NONE;
|
||||
public static boolean KeepAspectRatio = false;
|
||||
public static int ClickScreenPressure = 0;
|
||||
public static int ClickScreenTouchspotSize = 0;
|
||||
|
||||
@@ -87,7 +87,7 @@ class Settings
|
||||
out.writeInt(Globals.AudioBufferConfig);
|
||||
out.writeInt(Globals.TouchscreenKeyboardTheme);
|
||||
out.writeInt(Globals.RightClickMethod);
|
||||
out.writeBoolean(Globals.ShowScreenUnderFinger);
|
||||
out.writeInt(Globals.ShowScreenUnderFinger);
|
||||
out.writeInt(Globals.LeftClickMethod);
|
||||
out.writeBoolean(Globals.MoveMouseWithJoystick);
|
||||
out.writeBoolean(Globals.ClickMouseWithDpad);
|
||||
@@ -214,7 +214,7 @@ class Settings
|
||||
Globals.AudioBufferConfig = settingsFile.readInt();
|
||||
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
|
||||
Globals.RightClickMethod = settingsFile.readInt();
|
||||
Globals.ShowScreenUnderFinger = settingsFile.readBoolean();
|
||||
Globals.ShowScreenUnderFinger = settingsFile.readInt();
|
||||
Globals.LeftClickMethod = settingsFile.readInt();
|
||||
Globals.MoveMouseWithJoystick = settingsFile.readBoolean();
|
||||
Globals.ClickMouseWithDpad = settingsFile.readBoolean();
|
||||
@@ -1186,13 +1186,32 @@ class Settings
|
||||
void run (final MainActivity p)
|
||||
{
|
||||
CharSequence[] items = { p.getResources().getString(R.string.display_size_large),
|
||||
p.getResources().getString(R.string.display_size_small) };
|
||||
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), };
|
||||
if( ! Globals.SwVideoMode )
|
||||
{
|
||||
CharSequence[] items2 = { p.getResources().getString(R.string.display_size_large),
|
||||
p.getResources().getString(R.string.display_size_small_touchpad), };
|
||||
items = items2;
|
||||
}
|
||||
if( firstStart )
|
||||
{
|
||||
CharSequence[] items2 = { p.getResources().getString(R.string.display_size_large),
|
||||
p.getResources().getString(R.string.display_size_small),
|
||||
p.getResources().getString(R.string.show_more_options) };
|
||||
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), };
|
||||
items = items2;
|
||||
if( ! Globals.SwVideoMode )
|
||||
{
|
||||
CharSequence[] items3 = { p.getResources().getString(R.string.display_size_large),
|
||||
p.getResources().getString(R.string.display_size_small_touchpad),
|
||||
p.getResources().getString(R.string.show_more_options), };
|
||||
items = items3;
|
||||
}
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
@@ -1206,7 +1225,7 @@ class Settings
|
||||
{
|
||||
Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT;
|
||||
Globals.RelativeMouseMovement = false;
|
||||
Globals.ShowScreenUnderFinger = false;
|
||||
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
|
||||
}
|
||||
if( item == 1 )
|
||||
{
|
||||
@@ -1214,17 +1233,35 @@ class Settings
|
||||
{
|
||||
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR;
|
||||
Globals.RelativeMouseMovement = false;
|
||||
Globals.ShowScreenUnderFinger = true;
|
||||
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 = false;
|
||||
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
|
||||
}
|
||||
}
|
||||
if( item == 2 )
|
||||
if( item == 2 && Globals.SwVideoMode )
|
||||
{
|
||||
Globals.LeftClickMethod = Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT;
|
||||
Globals.RelativeMouseMovement = true;
|
||||
Globals.ShowScreenUnderFinger = Mouse.ZOOM_NONE;
|
||||
}
|
||||
if( item == 3 )
|
||||
{
|
||||
Globals.LeftClickMethod = Mouse.LEFT_CLICK_NEAR_CURSOR;
|
||||
Globals.RelativeMouseMovement = false;
|
||||
Globals.ShowScreenUnderFinger = Mouse.ZOOM_WHOLE_SCREEN;
|
||||
}
|
||||
if( item == 4 )
|
||||
{
|
||||
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 ) ) )
|
||||
{
|
||||
menuStack.clear();
|
||||
new MainMenu().run(p);
|
||||
@@ -1237,7 +1274,10 @@ class Settings
|
||||
builder.setItems(items, new ClickListener());
|
||||
else
|
||||
builder.setSingleChoiceItems(items,
|
||||
(Globals.LeftClickMethod == Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT && ! Globals.RelativeMouseMovement) ? 0 : 1,
|
||||
Globals.ShowScreenUnderFinger == Mouse.ZOOM_NONE ?
|
||||
( Globals.RelativeMouseMovement ? Globals.SwVideoMode ? 2 : 1 : 0 ) :
|
||||
( Globals.ShowScreenUnderFinger == Mouse.ZOOM_MAGNIFIER && Globals.SwVideoMode ) ? 1 :
|
||||
Globals.ShowScreenUnderFinger + 1,
|
||||
new ClickListener());
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
|
||||
{
|
||||
@@ -1442,14 +1482,12 @@ class Settings
|
||||
void run (final MainActivity p)
|
||||
{
|
||||
CharSequence[] items = {
|
||||
p.getResources().getString(R.string.pointandclick_showcreenunderfinger2),
|
||||
p.getResources().getString(R.string.pointandclick_joystickmouse),
|
||||
p.getResources().getString(R.string.click_with_dpadcenter),
|
||||
p.getResources().getString(R.string.pointandclick_relative)
|
||||
};
|
||||
|
||||
boolean defaults[] = {
|
||||
Globals.ShowScreenUnderFinger,
|
||||
Globals.MoveMouseWithJoystick,
|
||||
Globals.ClickMouseWithDpad,
|
||||
Globals.RelativeMouseMovement
|
||||
@@ -1463,12 +1501,10 @@ class Settings
|
||||
public void onClick(DialogInterface dialog, int item, boolean isChecked)
|
||||
{
|
||||
if( item == 0 )
|
||||
Globals.ShowScreenUnderFinger = isChecked;
|
||||
if( item == 1 )
|
||||
Globals.MoveMouseWithJoystick = isChecked;
|
||||
if( item == 2 )
|
||||
if( item == 1 )
|
||||
Globals.ClickMouseWithDpad = isChecked;
|
||||
if( item == 3 )
|
||||
if( item == 2 )
|
||||
Globals.RelativeMouseMovement = isChecked;
|
||||
}
|
||||
});
|
||||
@@ -2294,12 +2330,10 @@ class Settings
|
||||
{
|
||||
CharSequence[] items = {
|
||||
p.getResources().getString(R.string.pointandclick_keepaspectratio),
|
||||
p.getResources().getString(R.string.pointandclick_showcreenunderfinger2),
|
||||
p.getResources().getString(R.string.video_smooth)
|
||||
};
|
||||
boolean defaults[] = {
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.ShowScreenUnderFinger,
|
||||
Globals.SmoothVideo
|
||||
};
|
||||
|
||||
@@ -2307,13 +2341,11 @@ class Settings
|
||||
{
|
||||
CharSequence[] items2 = {
|
||||
p.getResources().getString(R.string.pointandclick_keepaspectratio),
|
||||
p.getResources().getString(R.string.pointandclick_showcreenunderfinger2),
|
||||
p.getResources().getString(R.string.video_smooth),
|
||||
p.getResources().getString(R.string.video_separatethread),
|
||||
};
|
||||
boolean defaults2[] = {
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.ShowScreenUnderFinger,
|
||||
Globals.SmoothVideo,
|
||||
Globals.MultiThreadedVideo
|
||||
};
|
||||
@@ -2325,11 +2357,9 @@ class Settings
|
||||
{
|
||||
CharSequence[] items2 = {
|
||||
p.getResources().getString(R.string.pointandclick_keepaspectratio),
|
||||
p.getResources().getString(R.string.pointandclick_showcreenunderfinger2)
|
||||
};
|
||||
boolean defaults2[] = {
|
||||
Globals.KeepAspectRatio,
|
||||
Globals.ShowScreenUnderFinger
|
||||
};
|
||||
items = items2;
|
||||
defaults = defaults2;
|
||||
@@ -2344,10 +2374,8 @@ class Settings
|
||||
if( item == 0 )
|
||||
Globals.KeepAspectRatio = isChecked;
|
||||
if( item == 1 )
|
||||
Globals.ShowScreenUnderFinger = isChecked;
|
||||
if( item == 2 )
|
||||
Globals.SmoothVideo = isChecked;
|
||||
if( item == 3 )
|
||||
if( item == 2 )
|
||||
Globals.MultiThreadedVideo = isChecked;
|
||||
}
|
||||
});
|
||||
@@ -2391,7 +2419,7 @@ class Settings
|
||||
nativeSetTrackballUsed();
|
||||
if( Globals.AppUsesMouse )
|
||||
nativeSetMouseUsed( Globals.RightClickMethod,
|
||||
Globals.ShowScreenUnderFinger ? 1 : 0,
|
||||
Globals.ShowScreenUnderFinger,
|
||||
Globals.LeftClickMethod,
|
||||
Globals.MoveMouseWithJoystick ? 1 : 0,
|
||||
Globals.ClickMouseWithDpad ? 1 : 0,
|
||||
|
||||
@@ -79,6 +79,10 @@ class Mouse
|
||||
public static final int SDL_FINGER_MOVE = 2;
|
||||
public static final int SDL_FINGER_HOVER = 3;
|
||||
|
||||
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_FULLSCREEN_MAGNIFIER = 3;
|
||||
}
|
||||
|
||||
abstract class DifferentTouchInput
|
||||
|
||||
@@ -565,7 +565,6 @@ int main(int argc, char* argv[])
|
||||
r.x -= r.w/2;
|
||||
r.y -= r.h/2;
|
||||
SDL_FillRect(screen, &r, color);
|
||||
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Mouse %d:%d buttons %d", mx, my, b);
|
||||
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
SDL_Event evt;
|
||||
|
||||
@@ -389,6 +389,8 @@ SDL_Surface *ANDROID_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
/* Set up the new mode framebuffer */
|
||||
SDL_CurrentVideoSurface = current;
|
||||
|
||||
UpdateScreenUnderFingerRect(0,0);
|
||||
|
||||
/* We're done */
|
||||
return(current);
|
||||
}
|
||||
@@ -861,19 +863,11 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects)
|
||||
for(i = 0; i < numrects; i++)
|
||||
SDL_UpdateTexture((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rects[i], SDL_CurrentVideoSurface->pixels, SDL_CurrentVideoSurface->pitch);
|
||||
}
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rect, &rect);
|
||||
static int MousePointerAlpha = 255;
|
||||
if(SDL_ANDROID_ShowMouseCursor)
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_NONE || SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER )
|
||||
{
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
x = x * SDL_ANDROID_sRealWindowWidth / SDL_ANDROID_sFakeWindowWidth;
|
||||
y = y * SDL_ANDROID_sRealWindowHeight / SDL_ANDROID_sFakeWindowHeight;
|
||||
SDL_ANDROID_DrawMouseCursor( x, y, 0, MousePointerAlpha );
|
||||
if( MousePointerAlpha > 64 )
|
||||
MousePointerAlpha -= 10 ;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &rect, &rect);
|
||||
}
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger && SDL_ANDROID_ShowScreenUnderFingerRect.w > 0 )
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER && SDL_ANDROID_ShowScreenUnderFingerRect.w > 0 )
|
||||
{
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &SDL_ANDROID_ShowScreenUnderFingerRectSrc, &SDL_ANDROID_ShowScreenUnderFingerRect);
|
||||
SDL_Rect frame = SDL_ANDROID_ShowScreenUnderFingerRect;
|
||||
@@ -901,9 +895,79 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects)
|
||||
glDrawArrays(GL_LINE_LOOP, 0, 4);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glPopMatrix();
|
||||
if(SDL_ANDROID_ShowMouseCursor)
|
||||
//glFlush();
|
||||
}
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_WHOLE_SCREEN )
|
||||
{
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &SDL_ANDROID_ShowScreenUnderFingerRectSrc, &SDL_ANDROID_ShowScreenUnderFingerRect);
|
||||
SDL_Rect edge, edgeSrc;
|
||||
// upper-left
|
||||
edge.x = edge.y = edgeSrc.x = edgeSrc.y = 0;
|
||||
edge.w = SDL_ANDROID_ShowScreenUnderFingerRect.x;
|
||||
edge.h = SDL_ANDROID_ShowScreenUnderFingerRect.y;
|
||||
edgeSrc.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.x;
|
||||
edgeSrc.h = SDL_ANDROID_ShowScreenUnderFingerRectSrc.y;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// left
|
||||
edge.y = SDL_ANDROID_ShowScreenUnderFingerRect.y;
|
||||
edgeSrc.y = SDL_ANDROID_ShowScreenUnderFingerRectSrc.y;
|
||||
edge.h = SDL_ANDROID_ShowScreenUnderFingerRect.h;
|
||||
edgeSrc.h = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// lower-left
|
||||
edge.y = SDL_ANDROID_ShowScreenUnderFingerRect.y + SDL_ANDROID_ShowScreenUnderFingerRect.h;
|
||||
edgeSrc.y = SDL_ANDROID_ShowScreenUnderFingerRectSrc.y + SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
edge.h = SDL_ANDROID_sFakeWindowHeight - edge.y;
|
||||
edgeSrc.h = SDL_ANDROID_sFakeWindowHeight - edgeSrc.y;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// lower
|
||||
edge.x = SDL_ANDROID_ShowScreenUnderFingerRect.x;
|
||||
edgeSrc.x = SDL_ANDROID_ShowScreenUnderFingerRectSrc.x;
|
||||
edge.w = SDL_ANDROID_ShowScreenUnderFingerRect.w;
|
||||
edgeSrc.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// lower-right
|
||||
edge.x = SDL_ANDROID_ShowScreenUnderFingerRect.x + SDL_ANDROID_ShowScreenUnderFingerRect.w;
|
||||
edgeSrc.x = SDL_ANDROID_ShowScreenUnderFingerRectSrc.x + SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
edge.w = SDL_ANDROID_sFakeWindowWidth - edge.x;
|
||||
edgeSrc.w = SDL_ANDROID_sFakeWindowWidth - edgeSrc.x;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// right
|
||||
edge.y = SDL_ANDROID_ShowScreenUnderFingerRect.y;
|
||||
edgeSrc.y = SDL_ANDROID_ShowScreenUnderFingerRectSrc.y;
|
||||
edge.h = SDL_ANDROID_ShowScreenUnderFingerRect.h;
|
||||
edgeSrc.h = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// upper-right
|
||||
edge.y = 0;
|
||||
edgeSrc.y = 0;
|
||||
edge.h = SDL_ANDROID_ShowScreenUnderFingerRect.y;
|
||||
edgeSrc.h = SDL_ANDROID_ShowScreenUnderFingerRectSrc.y;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
// upper
|
||||
edge.x = SDL_ANDROID_ShowScreenUnderFingerRect.x;
|
||||
edgeSrc.x = SDL_ANDROID_ShowScreenUnderFingerRectSrc.x;
|
||||
edge.w = SDL_ANDROID_ShowScreenUnderFingerRect.w;
|
||||
edgeSrc.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &edgeSrc, &edge);
|
||||
}
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_FULLSCREEN_MAGNIFIER )
|
||||
{
|
||||
SDL_RenderCopy((struct SDL_Texture *)SDL_CurrentVideoSurface->hwdata, &SDL_ANDROID_ShowScreenUnderFingerRectSrc, &SDL_ANDROID_ShowScreenUnderFingerRect);
|
||||
}
|
||||
|
||||
if(SDL_ANDROID_ShowMouseCursor)
|
||||
{
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_NONE || SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER )
|
||||
{
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
x = x * SDL_ANDROID_sRealWindowWidth / SDL_ANDROID_sFakeWindowWidth;
|
||||
y = y * SDL_ANDROID_sRealWindowHeight / SDL_ANDROID_sFakeWindowHeight;
|
||||
SDL_ANDROID_DrawMouseCursor( x, y, 0, 255 );
|
||||
}
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger != ZOOM_NONE )
|
||||
{
|
||||
MousePointerAlpha = 255;
|
||||
int x, y;
|
||||
SDL_GetMouseState(&x, &y);
|
||||
x = SDL_ANDROID_ShowScreenUnderFingerRect.x +
|
||||
@@ -916,7 +980,6 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects)
|
||||
y = y * SDL_ANDROID_sRealWindowHeight / SDL_ANDROID_sFakeWindowHeight;
|
||||
SDL_ANDROID_DrawMouseCursor( x, y, 16, 255 );
|
||||
}
|
||||
//glFlush();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ static int leftClickMethod = LEFT_CLICK_NORMAL;
|
||||
static int rightClickMethod = RIGHT_CLICK_NONE;
|
||||
static int leftClickKey = KEYCODE_DPAD_CENTER;
|
||||
static int rightClickKey = KEYCODE_MENU;
|
||||
int SDL_ANDROID_ShowScreenUnderFinger = 0;
|
||||
int SDL_ANDROID_ShowScreenUnderFinger = ZOOM_NONE;
|
||||
SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect = {0, 0, 0, 0}, SDL_ANDROID_ShowScreenUnderFingerRectSrc = {0, 0, 0, 0};
|
||||
static int moveMouseWithArrowKeys = 0;
|
||||
static int clickMouseWithDpadCenter = 0;
|
||||
@@ -159,49 +159,100 @@ void UpdateScreenUnderFingerRect(int x, int y)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
return;
|
||||
/*
|
||||
int screenX = 320, screenY = 240;
|
||||
if( !SDL_ANDROID_ShowScreenUnderFinger )
|
||||
return;
|
||||
|
||||
SDL_Window * window = SDL_GetFocusWindow();
|
||||
if( window && window->renderer->window ) {
|
||||
screenX = window->w;
|
||||
screenY = window->h;
|
||||
}
|
||||
*/
|
||||
#else
|
||||
int screenX = SDL_ANDROID_sFakeWindowWidth, screenY = SDL_ANDROID_sFakeWindowHeight;
|
||||
if( !SDL_ANDROID_ShowScreenUnderFinger )
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_NONE )
|
||||
return;
|
||||
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = screenX / 4;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = screenY / 4;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = x - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w/2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = y - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h/2;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x > screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y > screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.w * 3 / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.h = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h * 3 / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = x + SDL_ANDROID_ShowScreenUnderFingerRect.w/10;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = y - SDL_ANDROID_ShowScreenUnderFingerRect.h*11/10;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.x < 0 )
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER )
|
||||
{
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = screenX / 4;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = screenY / 4;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = x - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w/2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = y - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h/2;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = 0;
|
||||
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x > screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y > screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.w * 3 / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.h = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h * 3 / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = x + SDL_ANDROID_ShowScreenUnderFingerRect.w/10;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = y - SDL_ANDROID_ShowScreenUnderFingerRect.h*11/10;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.x < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.x + SDL_ANDROID_ShowScreenUnderFingerRect.w >= screenX )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w - 1;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.y + SDL_ANDROID_ShowScreenUnderFingerRect.h >= screenY )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h - 1;
|
||||
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 )
|
||||
{
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.w = screenX * 2 / 3;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.h = screenY * 2 / 3;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = x * (screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w) / screenX;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = y * (screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h) / screenY;
|
||||
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.x < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.x > screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.y > screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h;
|
||||
|
||||
/*
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = SDL_ANDROID_ShowScreenUnderFingerRect.w / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = SDL_ANDROID_ShowScreenUnderFingerRect.h / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = SDL_ANDROID_ShowScreenUnderFingerRect.x + (SDL_ANDROID_ShowScreenUnderFingerRect.w - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w) / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = SDL_ANDROID_ShowScreenUnderFingerRect.y + (SDL_ANDROID_ShowScreenUnderFingerRect.h - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h) / 2;
|
||||
*/
|
||||
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = screenX / 3;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = screenY / 3;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = x - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w/2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = y - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h/2;
|
||||
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x > screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y > screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
}
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_FULLSCREEN_MAGNIFIER )
|
||||
{
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = screenX / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = screenY / 2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = x - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w/2;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = y - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h/2;
|
||||
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.x > screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRectSrc.w;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRectSrc.y > screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
|
||||
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.y < 0 )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.x + SDL_ANDROID_ShowScreenUnderFingerRect.w >= screenX )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = screenX - SDL_ANDROID_ShowScreenUnderFingerRect.w - 1;
|
||||
if( SDL_ANDROID_ShowScreenUnderFingerRect.y + SDL_ANDROID_ShowScreenUnderFingerRect.h >= screenY )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.y = screenY - SDL_ANDROID_ShowScreenUnderFingerRect.h - 1;
|
||||
if( InsideRect(&SDL_ANDROID_ShowScreenUnderFingerRect, x, y) )
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.x = x - SDL_ANDROID_ShowScreenUnderFingerRect.w*11/10 - 1;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.w = screenX;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.h = screenY;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -472,7 +523,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
|
||||
|
||||
SDL_ANDROID_ShowScreenUnderFingerRect.w = SDL_ANDROID_ShowScreenUnderFingerRect.h = 0;
|
||||
SDL_ANDROID_ShowScreenUnderFingerRectSrc.w = SDL_ANDROID_ShowScreenUnderFingerRectSrc.h = 0;
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger )
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER )
|
||||
{
|
||||
// Move mouse by 1 pixel so it will force screen update and mouse-under-finger window will be removed
|
||||
if( moveMouseWithKbX >= 0 )
|
||||
@@ -587,8 +638,12 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeMouse) ( JNIEnv* env, jobject thiz, j
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateScreenUnderFingerRect(x, y);
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_MAGNIFIER )
|
||||
UpdateScreenUnderFingerRect(x, y);
|
||||
}
|
||||
if( SDL_ANDROID_ShowScreenUnderFinger == ZOOM_WHOLE_SCREEN ||
|
||||
SDL_ANDROID_ShowScreenUnderFinger == ZOOM_FULLSCREEN_MAGNIFIER )
|
||||
UpdateScreenUnderFingerRect(x, y);
|
||||
}
|
||||
if( pointerId != firstMousePointerId && (action == MOUSE_DOWN || action == MOUSE_UP) )
|
||||
{
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "SDL_joystick.h"
|
||||
#include "SDL_events.h"
|
||||
|
||||
enum ScreenZoom { ZOOM_NONE = 0, ZOOM_MAGNIFIER = 1, ZOOM_WHOLE_SCREEN = 2, ZOOM_FULLSCREEN_MAGNIFIER = 3 };
|
||||
|
||||
extern int SDL_ANDROID_sWindowWidth;
|
||||
extern int SDL_ANDROID_sWindowHeight;
|
||||
extern int SDL_ANDROID_sRealWindowWidth;
|
||||
|
||||
Reference in New Issue
Block a user