Defold 1.2.135 release postponed - And a look forward


Thanks. So, when you letterbox, you can letterbox game object content just fine (by setting the viewport and the projection matrix accordingly), but if you try to do that with GUI, there’s no way to tell the Adjust algorithm how tall the window is, so it will assume the window size.

In this example, I restricted the viewport to the bottom half of the screen:

render.set_viewport(0, 0, render.get_window_width(), render.get_window_height() * 0.5)
render.set_projection(vmath.matrix4_orthographic(0, render.get_window_width(), 0, render.get_window_height() * 0.5, -1, 1))

And instead of getting a centered box in the restricted viewport, the box centers relative to the whole screen:

Of course, when you try to offset the viewport (to center it in the middle of the screen, for example), then your input will not offset and you’d have to have a function that transforms your action’s coordinates before you use them, but that is an acceptable workaround. The problem is that there’s no workaround for GUI scenes other than disabling Auto-Adjust and doing your layout adjustments manually on window resize.