@ -3835,22 +3835,7 @@ Vector2 GetTouchPosition(int index)
/ / https : / / docs . microsoft . com / en - us / windows / win32 / wintouch / getting - started - with - multi - touch - messages
if ( index = = 0 ) position = GetMousePosition ( ) ;
# endif
# if defined(PLATFORM_ANDROID)
if ( index < MAX_TOUCH_POINTS ) position = CORE . Input . Touch . position [ index ] ;
else TRACELOG ( LOG_WARNING , " INPUT: Required touch point out of range (Max touch points: %i) " , MAX_TOUCH_POINTS) ;
if ( ( CORE . Window . screen . width > CORE . Window . display . width ) | | ( CORE . Window . screen . height > CORE . Window . display . height ) )
{
position . x = position . x * ( ( float ) CORE . Window . screen . width / ( float ) ( CORE . Window . display . width - CORE . Window . renderOffset . x ) ) - CORE . Window . renderOffset . x / 2 ;
position . y = position . y * ( ( float ) CORE . Window . screen . height / ( float ) ( CORE . Window . display . height - CORE . Window . renderOffset . y ) ) - CORE . Window . renderOffset . y / 2 ;
}
else
{
position . x = position . x * ( ( float ) CORE . Window . render . width / ( float ) CORE . Window . display . width ) - CORE . Window . renderOffset . x / 2 ;
position . y = position . y * ( ( float ) CORE . Window . render . height / ( float ) CORE . Window . display . height ) - CORE . Window . renderOffset . y / 2 ;
}
# endif
# if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
# if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
if ( index < MAX_TOUCH_POINTS ) position = CORE . Input . Touch . position [ index ] ;
else TRACELOG ( LOG_WARNING , " INPUT: Required touch point out of range (Max touch points: %i) " , MAX_TOUCH_POINTS) ;
# endif
@ -5675,9 +5660,11 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
/ / Register touch points position
CORE . Input . Touch . position [ i ] = ( Vector2 ) { AMotionEvent_getX ( event , i ) , AMotionEvent_getY ( event , i ) } ;
/ / Normalize CORE . Input . Touch . position [ x ] for screenWidth and screenHeight
CORE . Input . Touch . position [ i ] . x / = ( float ) GetScreenWidth ( ) ;
CORE . Input . Touch . position [ i ] . y / = ( float ) GetScreenHeight ( ) ;
/ / Normalize CORE . Input . Touch . position [ i ] for CORE . Window . screen . width and CORE . Window . screen . height
float widthRatio = ( float ) ( CORE . Window . screen . width + CORE . Window . renderOffset . x ) / ( float ) CORE . Window . display . width ;
float heightRatio = ( float ) ( CORE . Window . screen . height + CORE . Window . renderOffset . y ) / ( float ) CORE . Window . display . height ;
CORE . Input . Touch . position [ i ] . x = CORE . Input . Touch . position [ i ] . x * widthRatio - ( float ) CORE . Window . renderOffset . x / 2 ;
CORE . Input . Touch . position [ i ] . y = CORE . Input . Touch . position [ i ] . y * heightRatio - ( float ) CORE . Window . renderOffset . y / 2 ;
}
int32_t action = AMotionEvent_getAction ( event ) ;