I have built a zoom feature in my tile based game but I can’t figure out how to handle the mouse movement when the game is zoomed in.
The way I do this is I draw the target scene to a texture with a fixed size (say 1920x1080) and then I RenderCopy as,
SDL_RenderCopy(renderer, sceneTexture, &zoomRect, nullptr);
where zoomRect is initialized at the texture resolution and then decrements by scrolling the mouse wheel. The effect is that the user can magnify the scene as a smaller and smaller source rectangle is drawn to the screen.
The issue I have is that when the user is magnified in, he or she can no longer move properly because moving the mouse one tile is now moving the mouse by several tiles (due to the magnification). I think the affect is something similar to having a different screen and logical resolution. Do I need some kind of mouse scaling like SDL_RenderWindowToLogical?