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 - Wrong touch input coords values
Summary: Wrong touch input coords values
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: 2.0.8
Hardware: ARM Android (All)
: P2 critical
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-06 09:57 UTC by 000whitedragon000
Modified: 2019-08-06 05:06 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 );