Letterboxing/Pillarboxing in h2d?

I’m trying to maintain a constant aspect ratio regardless of the window size, and I’ve been scratching my head trying to figure it out. s2d.setFixedSize(x,y) stretches the image to fit the screen; is there a way to automatically scale the scene so it maintains the aspect ratio and stays centered in the window?

You can override onResize on your hxd.App in order to perform the necessary setFixedSize/scaling

1 Like