Hi Dale,
to handle multiple resolutions, make sure you check the ‘identical layout’ box in autoSD, which should enable you to use Corona’s built-in multiresolution support. Other option - which allows for different layouts and thus less textures - is to ditch the Corona side of things completely and just manually load the correct sheet and script according to the resolution, eg:
if ( display.pixelWidth / display.actualContentWidth ) \> 0.8 then sheetData = require("sheet@2x") sheetImage = graphics.newImageSheet("sheet@2x.png",sheetData:getSheet()) else sheetData = require("sheet") sheetImage = graphics.newImageSheet("sheet.png",sheetData:getSheet()) end
The 0.8 being the same ratios as corona’s config uses.
For loading spine images from imagesheet, a more complete (but a bit simpler) example would be:
local json = spine.SkeletonJson.new() skeletonData = json:readSkeletonDataFile(filename) animation = self.skeletonData:findAnimation(animation) skeleton = spine.Skeleton.new(skeletonData) function skeleton:createImage(attachment) local frameIndex = sheetData:getFrameIndex(attachment.name) return display.newImageRect(group, sheetImage, frameIndex, attachment.width,attachment.height) end skeleton:setToSetupPose() skeleton:updateWorldTransform()
The technique above by gtt extends this approach a little bit, allowing for quicker changes of the images through the Corona sprite system.
Hope this helps,
Matias