Hi!
I'm involved with the Escoria adventure game framework, trying to get some features that make for modern games, and am struggling with zooming.
The use-cases include talking to NPCs so that the camera closes in on the conversation and having the player move to a part of the screen and the camera pushes in.
Thus far my best results have been calculating the game ratio and using
func set_zoom_height(zoom_height):
var game_size_ratio = game_size.x / game_size.y
zoom_viewport = Vector2(zoom_height * game_size_ratio, zoom_height)
viewport.set_size_override(true, zoom_viewport)
However, when I pass in a completely other zoom_height
, the other things in the screen, like tooltips or the right-mouse-button menu, are also zoomed in!
I have not been able to find an approach to fixing this, so does anyone here have leads for me?
I have tried using a different viewport than /root
(and a separate Camera2D
as its child), but apparently it doesn't matter - anything rendered in the viewport always gets scaled. Is this a correct understanding?
Also I dabbled in calling .set_size()
on child elements, but this does not seem to scale them at all, as if the call has no effect! Should it?
This solution would probably perform very badly, because the engine would constantly have to check if the scaling has already been applied. Am I right?
Is it possible to have two different viewports overlap, only one of which gets scaled?
Would there be a completely different approach I haven't tried yet?
Thanks!