We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4126

Summary: Wrong touch input coords values
Product: SDL Reporter: 000whitedragon000
Component: eventsAssignee: Sam Lantinga <slouken>
Status: NEW --- QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: Roung1990
Version: 2.0.8   
Hardware: ARM   
OS: Android (All)   

Description 000whitedragon000 2018-04-06 09:57:46 UTC
event (from PollEvent) SDL_FINGERDOWN/SDL_FINGERMOTION doesn't return right values..
Values are not normalized (the official guide shows values between 0 and 1) but negative values are also returned.

However, when the screen is in one place, the value returned is randomly wrong.

This bug occurs if the game / app texture is created with SDL_CreateTexture() and SDL_TEXTUREACCESS_STREAMING and if the texture is not fullscreen.
So in this case for example ev.tfinger.x*nativeWidth are randomly wrong.

reference project: https://github.com/DCurrent/openbor
files:
https://github.com/DCurrent/openbor/blob/master/engine/android/jni/openbor/video.c
https://github.com/DCurrent/openbor/blob/master/engine/sdl/control.c
Comment 1 000whitedragon000 2018-04-21 04:31:30 UTC
I confirm the bug when use SDL_RenderSetLogicalSize()
Comment 2 Kostyarezkiy 2019-08-06 05:06:47 UTC
This isn't a bug. You just need to multiply it by the screenwidth.

int Xclick = e.tfinger.x * SCREENWIDTH;//technically this is a float value, but we can make it int fine.
int Yclick = e.tfinger.y * SCREENWIDTH;
SDL_Log(" X %d  Y %d \n",Xclick , Yclick );