SDL_GetMouseState and SDL_RenderSetLogicalSize

I have a full screen window at 1920x1080 with a logical render size of 1440x900. I noticed that the x,y reported by the MouseMotionEvent is different than the x,y reported by GetMouseState. Documentation for both methods describe the coordinates as “relative to the window”. I have noticed that GetMouseState does not take the logical size scaling into its position report, whereas MouseMotionEvent does take the scaling into account. Glancing at the source seems to confirm my suspicions.

Can anyone confirm/deny? If my guess is correct, is GetMouseState ignoring the logical scaling intended?

As far as I know, the SDL_GetMouseState code doesn’t pass through event
filters. Setting a logical size sets up an event filter that alters the
event data before you get it. (You’ve probably seen that)

I would suppose the difference is intentional, but only because the API
doesn’t include the ability to interfere with state requests.

Jonny DOn Sun, Jan 12, 2014 at 7:57 PM, arosian <justin.d.skiles at gmail.com> wrote:

I have a full screen window at 1920x1080 with a logical render size of
1440x900. I noticed that the x,y reported by the MouseMotionEvent is
different than the x,y reported by GetMouseState. Documentation for both
methods describe the coordinates as “relative to the window”. I have
noticed that GetMouseState does not take the logical size scaling into its
position report, whereas MouseMotionEvent does take the scaling into
account. Glancing at the source seems to confirm my suspicions.

Can anyone confirm/deny? If my guess is correct, is GetMouseState ignoring
the logical scaling intended?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I would suppose the difference is intentional, but only because the
API doesn’t include the ability to interfere with state requests.

Actually, that would rather suggest the difference is accidental, as it
only stems from the implementation differences of SDL_GetMouseState and
MouseMotionEvent.

On the other hand, there should be at least one place to get unaltered
coordinates, I guess.On Sun, 12 Jan 2014 23:40:18 -0500 Jonathan Dearborn wrote:


driedfruit

I have found and notified previously various anomalous behaviours regarding mouse coordinates when scaling is active.

The same problem is present when using SDL_WarpMouseInWindow().

And regarding the use of GetMouseState to get mouse coordinate, I had to remove its use when migrated my applications from SDL 1.2 to SDL2.0.x------------------------
Armando Alaminos Bouza

Yeah, that’s a shame. SDL_gpu makes you do the conversion explicitly via
GPU_GetVirtualCoords(), which might seem like a reasonable approach.
Otherwise, I would expect SDL to do it for me and hide the details in the
aforementioned functions.

Jonny DOn Mon, Jan 13, 2014 at 12:12 PM, alabouza wrote:

I have found and notified previously various anomalous behaviours
regarding mouse coordinates when scaling is active.

The same problem is present when using SDL_WarpMouseInWindow().

And regarding the use of GetMouseState to get mouse coordinate, I had to
remove its use when migrated my applications from SDL 1.2 to SDL2.0.x


Armando Alaminos Bouza


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Where can I find “GPU_GetVirtualCoords()” ?? Is this a public symbol in SDL2 ?

Thanks

[quote=“Jonny D”]Yeah, that’s a shame. ?SDL_gpu makes you do the conversion explicitly via GPU_GetVirtualCoords(), which might seem like a reasonable approach. ?Otherwise, I would expect SDL to do it for me and hide the details in the aforementioned functions.

Jonny D------------------------
Armando Alaminos Bouza

No, sorry. That is part of an extension library, SDL_gpu, and only
interacts with the state stored by that library.

Jonny DOn Mon, Jan 13, 2014 at 1:51 PM, alabouza wrote:

Where can I find “GPU_GetVirtualCoords()” ?? Is this a public symbol in
SDL2 ?

Thanks

[quote=“Jonny D”]Yeah, that’s a shame. SDL_gpu makes you do the
conversion explicitly via GPU_GetVirtualCoords(), which might seem like a
reasonable approach. Otherwise, I would expect SDL to do it for me and
hide the details in the aforementioned functions.

Jonny D


Armando Alaminos Bouza


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org