无法完全适合背景图片
Cannot fit background image fully
所以我正在尝试将我的 350x570 图像文件完全适合作为背景。但无论我做什么,它都不起作用。这是我的代码:
display.setStatusBar(display.HiddenStatusBar)
local background = display.newImageRect("background.png", display.contentWidth, display.contentHeight)
background.x = display.contentCenterX
background.y = display.contentCenterY
这是我得到的:
如图所示,有两个黑条,因为它没有正确安装。但我不知道为什么。代码看起来没问题,请问有什么问题吗?
Corona SDK的内部坐标系取决于config.lua文件中定义的内容区域。点 (0,0) 位于此内容区域的左上角。如果您使用默认的 Config.lua 文件,则点 (0,0) 可能不会位于屏幕的左上角。
config.lua
现代化教程
https://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/
终极Config.lua文件
所以我正在尝试将我的 350x570 图像文件完全适合作为背景。但无论我做什么,它都不起作用。这是我的代码:
display.setStatusBar(display.HiddenStatusBar)
local background = display.newImageRect("background.png", display.contentWidth, display.contentHeight)
background.x = display.contentCenterX
background.y = display.contentCenterY
这是我得到的:
如图所示,有两个黑条,因为它没有正确安装。但我不知道为什么。代码看起来没问题,请问有什么问题吗?
Corona SDK的内部坐标系取决于config.lua文件中定义的内容区域。点 (0,0) 位于此内容区域的左上角。如果您使用默认的 Config.lua 文件,则点 (0,0) 可能不会位于屏幕的左上角。
config.lua
现代化教程https://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/
终极Config.lua文件