Hello, I’m really getting into the swing of learning Lua and trying to take advantages of the neat little tricks that Corona has waiting to be used.
One of the things I really like is its ability to select the higher-resolution files whenever a @2x (or whatever suffix) is available, but it appears to only be used with display.newImageRect and not display.newImage.
Upon looking closely in ui.lua where I’m implementing my menu buttons, it’s using display.newImage:
[code]---------------
– Button class
function newButton( params )
local button, default, over, size, font, textColor, offset
if params.default then
button = display.newGroup()
default = display.newImage( params.default )
button:insert( default, true )
end
if params.over then
over = display.newImage( params.over )
over.isVisible = false
button:insert( over, true )
end
…
[/code]
I’m trying to change it to default = display.newImageRect( params.default ) but it’s crashing. I believe display.newImageRect requires the dimensions to be passed along with the file, but display.newImage does not.
So, how can I automatically include the dimensions, or what other code do I have to change/implement to make it work? Do I have to manually pass dimensions into the function beforehand?
Thanks in advance. [import]uid: 6084 topic_id: 5859 reply_id: 305859[/import]
[import]uid: 10361 topic_id: 5859 reply_id: 26220[/import]