Mouse x,y and SDL_SetRenderScale

I’ll write code if you don’t know what I mean
Using SDL3 I’ll call SDL_SetRenderScale(renderer, 3, 3) on my monitor with a pixel density of 1. When I use FillRect at 0, 0, 150, 150, it’ll draw a 450x450 rect as I expect. When I click at the bottom right of the rect the event says the x, y is 450. Shouldn’t it be 150 to match the scale? What’s the ‘correct’ solution if I want to adjust this? Do I check if I’m using the fake density and divide the x,y by it?

On my devices with > 1 pixel density I still call SDL_SetRenderScale but the x,y coords are always correct

Try using SDL_ConvertEventToRenderCoordinates in your event loop.

1 Like

That seems to do what I want thanks.
I read through the SDL3 documentation when 3 released, I think I should read through it again because I didn’t remember any function like that