Hi.
I want to create a mobile game using only GUI elements. I will use a ZOOM adjustment mode for all nodes, and I believe that adjustment is calculated like this:
local DISPLAY_SIZE = vmath.vector3(640, 1136, 0)
local window_size
do
local width, height = window.get_size() -- width = 720, height = 1545
window_size = vmath.vector3(width, height, 0)
end
local adjust_zoom_scale = math.max(
window_size.x / DISPLAY_SIZE.x,
window_size.y / DISPLAY_SIZE.y
)
Let’s say I want a GUI node that always spans the width of the window, I could do this:
local node = gui.get_node("my_node")
gui.set_adjust_mode(node, gui.ADJUST_ZOOM)
gui.set_xanchor(node, gui.ANCHOR_LEFT)
gui.set_yanchor(node, gui.ANCHOR_TOP)
gui.set_size(node, vmath.vector3(window_size.x / adjust_zoom_scale, 100, 0))
Yet the node still overflows the window.