Corona Dynamic Scaling

I am using three images in my project
a.png
a@2x.png
a@4x.png

and make setting in config.lua file

imageSuffix = {
["@2x"] = 2,
["@4x"] = 4,
}

It is not working for me. It loading only single a.png for iphone and ipad both , it is not load dynamic image as per device.

Please help anyone
Thanks. [import]uid: 220966 topic_id: 35627 reply_id: 335627[/import]

Have you seen this:
http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/ [import]uid: 77199 topic_id: 35627 reply_id: 141644[/import]

Yes, I have seen that link also , Still not working [import]uid: 220966 topic_id: 35627 reply_id: 141646[/import]

Can you please post a line of code where you display this “a” image? Thanks! [import]uid: 200026 topic_id: 35627 reply_id: 141714[/import]

Hi
I got the solution , I am using another method for loading image
display.newImageRect() this is method use to load dynamic assets

But I am facing another problem when I am this method my game is going to stuck on ipad and ipad3

function loadBg()
if (mycar.x > t and levelCount < allLevelCount) then
local b = display.newImageRect(“b.png”,480,500)
b.x = 720
b.y = 80
game:insert(b)
t = t+400
end
end
Runtime:addEventListener(“enterFrame”, loadBg)

This is my code where I am at runtime loading background image. But it is going to stuck while loading. [import]uid: 220966 topic_id: 35627 reply_id: 141806[/import]

Hi
I got the solution , I am using another method for loading image
display.newImageRect() this is method use to load dynamic assets

But I am facing another problem when I am use this method my game is going to stuck on ipad and ipad3

function loadBg()
if (mycar.x > t and levelCount < allLevelCount) then
local b = display.newImageRect(“b.png”,480,500)
b.x = 720
b.y = 80
game:insert(b)
t = t+400
end
end
Runtime:addEventListener(“enterFrame”, loadBg)

This is my code where I am loading background image at runtime . But it is going to stuck while loading. [import]uid: 220966 topic_id: 35627 reply_id: 141805[/import]

Hello again,
What kind of game are you developing? Is this some kind of scrolling background, where you move one “piece” of the background, then after some time, you put another “piece” in place? I’m not clear why you’re using a Runtime listener here… [import]uid: 200026 topic_id: 35627 reply_id: 141808[/import]

Hi
I am developing game , where I am going to load graphics at runtime because when I load all graphics at the start of game ios give memory error and game is not going to start , so I am loading graphics at runtime.
In my game lots of bg images and I need to change bg after some specifice distance interval.
Suppose I have 50 bg images and I need to change bg images 1 to 50, one after another .
But at starting I could not load all bg images in game , because it using more than 50 mb texture memory so game will not start on ipad3

If Runtime listener is wrong way to load then please help me how can I do this
Thanks [import]uid: 220966 topic_id: 35627 reply_id: 141811[/import]

Hello,
That would be the correct method (loading images during Runtime) if the texture memory limit is being exceeded. However, you might see a small “skip” in your game when you load large images during Runtime. This is a limitation of mobile devices as they load (larger) assets.

For testing, please add this line to your “main.lua”…

print(1/display.contentScaleX, 1/display.contentScaleY)

Then, run the app in the Corona Simulator and observe the value in the Terminal/console. Switch the “Window > View As” from “iPhone” to “iPhone 4” to “iPhone 5” to “iPad” to “iPad Retina” and tell me the values that you see.

Thanks!
Brent [import]uid: 200026 topic_id: 35627 reply_id: 141816[/import]

Hi,
This are values are values

values : 1/display.contentScaleX, 1/display.contentScaleY
iphone : 1 1
iphone4 : 2 2
iphone5 :2.3666666690177 2
ipad: 2.1333333333333 2.4000000572205
ipad Retina :4.2666666666667 4.8000001144409

Thanks [import]uid: 220966 topic_id: 35627 reply_id: 141821[/import]

OK… and you say “It’s loading only single a.png for iphone and ipad both”…

Which exact devices in the previous post (which iPhone models and which iPad models) are using which image version?
[import]uid: 200026 topic_id: 35627 reply_id: 141822[/import]

I am developing iphone+ipad app
I am using three images,
ie.
a.png = 480*500 (width*height)
a@2x.png = 960*1000
a@4x.png = 1920*2000

imageSuffix = {
["@2x"] = 2,
["@4x"] = 4,
},

This suffix info in config.lua file

As I told I am using this method to load image
display.newImageRect(“a.png”,480,500)
This method automatically choose image as per device resolution.
When I running game on iphone4/ipad/ipad3, it loading images but not smoothly and it stucks the game

Thanks.
[import]uid: 220966 topic_id: 35627 reply_id: 141825[/import]

Are there transparent areas in your backgrounds?

If not, you could try using .jpgs and you may find you can fit your 50-odd images into memory before the game starts. Otherwise as Brent says, loading these large images into memory on the fly will cause your game to stutter.

EDIT: Thinking about it, does the file type/quality of the source file affect how much texture memory is used…perhaps a texture is a texture once it’s loaded into memory :-/ [import]uid: 93133 topic_id: 35627 reply_id: 141848[/import]

Have you seen this:
http://www.coronalabs.com/blog/2012/12/04/the-ultimate-config-lua-file/ [import]uid: 77199 topic_id: 35627 reply_id: 141644[/import]

Yes, I have seen that link also , Still not working [import]uid: 220966 topic_id: 35627 reply_id: 141646[/import]

Can you please post a line of code where you display this “a” image? Thanks! [import]uid: 200026 topic_id: 35627 reply_id: 141714[/import]

Hi
I got the solution , I am using another method for loading image
display.newImageRect() this is method use to load dynamic assets

But I am facing another problem when I am this method my game is going to stuck on ipad and ipad3

function loadBg()
if (mycar.x > t and levelCount < allLevelCount) then
local b = display.newImageRect(“b.png”,480,500)
b.x = 720
b.y = 80
game:insert(b)
t = t+400
end
end
Runtime:addEventListener(“enterFrame”, loadBg)

This is my code where I am at runtime loading background image. But it is going to stuck while loading. [import]uid: 220966 topic_id: 35627 reply_id: 141806[/import]

Hi
I got the solution , I am using another method for loading image
display.newImageRect() this is method use to load dynamic assets

But I am facing another problem when I am use this method my game is going to stuck on ipad and ipad3

function loadBg()
if (mycar.x > t and levelCount < allLevelCount) then
local b = display.newImageRect(“b.png”,480,500)
b.x = 720
b.y = 80
game:insert(b)
t = t+400
end
end
Runtime:addEventListener(“enterFrame”, loadBg)

This is my code where I am loading background image at runtime . But it is going to stuck while loading. [import]uid: 220966 topic_id: 35627 reply_id: 141805[/import]

Hello again,
What kind of game are you developing? Is this some kind of scrolling background, where you move one “piece” of the background, then after some time, you put another “piece” in place? I’m not clear why you’re using a Runtime listener here… [import]uid: 200026 topic_id: 35627 reply_id: 141808[/import]

Hi
I am developing game , where I am going to load graphics at runtime because when I load all graphics at the start of game ios give memory error and game is not going to start , so I am loading graphics at runtime.
In my game lots of bg images and I need to change bg after some specifice distance interval.
Suppose I have 50 bg images and I need to change bg images 1 to 50, one after another .
But at starting I could not load all bg images in game , because it using more than 50 mb texture memory so game will not start on ipad3

If Runtime listener is wrong way to load then please help me how can I do this
Thanks [import]uid: 220966 topic_id: 35627 reply_id: 141811[/import]