Image sheet and auto scaling

Hi All,

i’ve been playing with imagesheet because it will worth to use it for next project.
I’m trying to make aouto scale working but it seem not to work at all.

First of all i produced 3 image sheet:

512x512, 1024x1024 and 2048x2048.

each sheet has images inside resize as well by 1, 2 and 4.

Used this config lua:

application =  
{  
 content =  
 {  
 antialias = false,  
 width = 360,  
 height = 480,  
 scale = "zoomEven",  
 fps = 60,  
 imageSuffix =  
 {  
 ["@2"] = 2,  
 ["@4"] = 4  
 },  
 },  
}  

here the options array:

  
local options =  
{  
 -- array of tables representing each frame (required)  
 frames = {  
 {x = 207, y = 440, width = 31, height = 38},  
 { x = 91, y = 355, width = 23, height = 48 }  
 },  
  
 sheetContentWidth = 512,  
 sheetContentHeight = 512  
}  

used a complex one.
Finally the object:

imageSheet = graphics.newImageSheet( "img/ingame/tds/imageSheet.png", options )  
  
 background = display.newImageRect( group, "img/ingame/tds/fondo.png", 481, 361 )  
 background.x, background.y = midX, midY  
  
 zero = display.newImageRect( group, imageSheet, 1, 31, 38 )  
 zero.x, zero.y = midX, midY  

i’m inside create scene.
It seem scaling correctly the background but not the zero object.
The Ipad 2 and new Ipad version as the iphone retina are not upscaled.

do i miss something? [import]uid: 104317 topic_id: 25421 reply_id: 325421[/import]

Your config.lua should look like this :

application = { content = { antialias = false, width = 320, --Why did you have 360? height = 480, scale = "zoomEven", fps = 60, imageSuffix = { ["@2"] = 2, ["@4"] = 4 }, }, } [import]uid: 84637 topic_id: 25421 reply_id: 102721[/import]

i do use ipad proportion on iphone device then the 40pxes more are cropped on the iphone.
So 1024x768 become 480x360 and 360 is cropped out of the screen by 20 pxes per side.

Using that 40 pixels for decorative stuff.

Is there another way to do it? [import]uid: 104317 topic_id: 25421 reply_id: 102731[/import]

Actually after some test still don’t get how it should work.
Using texture packer is it not easy (maybe possible) generating 512, 1024 and 2048 sheet having same images position, as i assume images inside sheet have to have same position in the three dimension because we pass only the options array with the position of the smaller.

Anyone got thought the 3 resolution imagesheet + autoscaling? And got successfully? [import]uid: 104317 topic_id: 25421 reply_id: 102747[/import]

NoOne got this problem solved or got same problem? [import]uid: 104317 topic_id: 25421 reply_id: 103281[/import]

Looking into it it seems that the imagesheet just scale coordinates, but do not load the correct image png (low, @2 or @4). So you have to force it to load the right imagesheet png by if.

Should not corona load by it self the right imagesheet png?
[import]uid: 104317 topic_id: 25421 reply_id: 103289[/import]

After exporting the 3 different spritesheets with TexturePacker (iPhone, Retina and iPad 3. iPad uses the retina one), I manually load the related ImageSheet:

[lua]local scale, scaleY, suffix = display.contentScaleX, display.contentScaleY, “”
if scale < 1 and scale > 0.6 then suffix = “@1_5x
elseif scale > 0.3 and scale < 0.6 then suffix = “@2x
elseif scale <= 0.25 then suffix = “@4x” end
_G.scale, _G.suffix = scale, suffix

local sheetInfo = require(“game” … suffix) – lua file that Texture packer published
local myImageSheet = graphics.newImageSheet(“game” … suffix … “.png”, sheetInfo:getSheet())[/lua] [import]uid: 10990 topic_id: 25421 reply_id: 104762[/import]

Thanks karnakgames, at last i went for that way as well. [import]uid: 104317 topic_id: 25421 reply_id: 104849[/import]

Just wondering.
When loading imagesheets this way, you have to scale all of the images on your own, right? [import]uid: 109453 topic_id: 25421 reply_id: 114272[/import]