These values:
sys.get_config_number("display.width")
sys.get_config_number("display.height")
are the logical resolution configured in game.project
in your case 1136 × 640. They do not report the device’s physical resolution.
window.get_size() returns the rendering surface Android provides to Defold.
Android and device manufacturers can apply Game Mode optimizations per package. This explains why changing only the package name changes the result.
You can check for package-specific settings using:
adb shell device_config get game_overlay com.xxx.shiboriLand
adb shell dumpsys platform_compat
In the second output, look for your package name and these Android compatibility changes:
DOWNSCALED 168419799
DOWNSCALE_75 189969779
Also check whether the device’s Game Booster or Game Mode has a resolution or battery-saving option enabled for this game.
Banners: the extension returns the banner dimensions in Defold screen-space pixels, matching the coordinate system used by window.get_size(). You should not apply the Android density or the 0.75 factor yourself.
If you want to move a GUI node by the banner height, you can work directly in screen space:
local node = gui.get_node("content")
local position = gui.get_screen_position(node)
position.y = position.y + message.height
gui.set_screen_position(node, position)
If you need the banner height in the node’s local coordinate system. For example, to resize a node or use gui.set_position()—convert the screen-space distance using gui.screen_to_local():
local function screen_height_to_local(node, screen_height)
local p0 = gui.screen_to_local(node, vmath.vector3(0, 0, 0))
local p1 = gui.screen_to_local(node, vmath.vector3(0, screen_height, 0))
return p1.y - p0.y
end
local node = gui.get_node("content")
local banner_height = screen_height_to_local(node, message.height)
local position = gui.get_position(node)
position.y = position.y + banner_height
gui.set_position(node, position)
This conversion takes the node’s parents, anchors, adjust mode, and current GUI layout into account.
In short, it doesn’t matter what Android returns. You just need to convert values from screen (window) space into GUI space. For that, it doesn’t matter exactly which values you get; you just need to know which space they are in.