Hi,
One aspect of Corona that I’m confused by is the sheetContentWidth/sheetContentHeight options in newImageSheet.
What confuses me is why these are needed at all? Shouldn’t the image file meta data itself indicate its width and height? And how exactly does this help with the dynamic scaling? I’ve read that section of the docs over and over and saw no references to the sheetContentWidth/Height - only to the selection of images based on the suffixes.
If you specify a sprite frame size, the number of frames, and the file contains its dimensions (as they all do) why would you then indicate the sheet size unless it is somehow smaller than the image size? And again, what does any of it have to do with scaling of 1x? the dynamic scaling seems to ask you to define the “@2x” monikers in your filenames, so presumably that would tell the sdk what the original scale was and I wouldn’t have to specify it myself during sheet creation?
The docs say:
These values tell Corona the size of the original 1x image sheet. For example, if you’re developing for both iPad and iPad Retina, and you’re using an image sheet of 1000×1000 for the regular iPad, you should specify 1000 for both of these values and then design your Retina image sheet at 2000×2000.
Please help me understand this. If my retina version of the sheet is 500x50, and has 10 sprites of 50x50, and I have 2 png image sheets - 1 that is 500x50 (2X for Retina iPad - lets call it “ship@2x.png”) and 1 that is 250x25 (1X for regular ipad - “ship.png”) that when I go to load the sheet on EITHER ipad or ipad retina I would use the exact same line:
spritesheet = graphics.newImageSheet( “ship.png”, {width=25, height=25, numFrames=10, sheetContentWidth=250, sheetContentHeight=25})
…and that the SDK will automatically adjust the image sheet name to ship@2x.png for the iPad retina (if I define it properly in my config.lua) and use ship.png automatically for ipad? correct?
What confuses me further (assuming the above is essentially correct- and I don’t know that it is) is that I had planned to use adaptive scaling - so that presumably the stage content[width|height] is going to match the device’s display resolution. So would the sprites for iPad Retina be 25x25 or 50x50? I mean, I get that if I were using a fixed content scale for the application that the screen gets stretched and the coordinate system presumably is mapped for the display resolution. But if you use adaptive scaling, then what should I expect when I go to provide offsets into the sprite’s local object space? a 50x50 area or a 25x25 area? Is that entirely determined by the resolution of the 1x sprite?
Thanks- I know I asked a few questions here. I’ve been searching the forums and google for quite a while, and I’m sure this is a newbie question that I just haven’t grasped yet. I appreciate your patience in entertaining it once again if I’ve failed to find the definitive thread on it. I watched the video on dynamic scaling and it didn’t clear it up for me. I guess its the whole “adaptive” scale setting in the config.lua that is confusing me because I then have no basis for what my 1x sprites represent in relation to the screen- if that makes sense.
thanks,
Byron