Another one for Dynamic Content Scale

Hello everyone, I am struggling with the config.lua file for my project. My main issue is the fact that, instead creating a 320x480 (iPhone) and resize the images, I created an iPad project and downsize the images.

I figured out a way to handle the "downsize" for the iPhone but, for iPhone4, I do not have success (it shows the images for the iPhone, instead the ones for the iPad). Any ideas on what am I doing wrong here?

My config.lua file below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if system.getInfo("model") ~= "iPad" and system.getInfo("model") ~= "iPhone4" then   
        application =
        {
                content =
                {
                        --zoom
                        width = 768,
                        height = 1024,
                        fps = 60,
                        scale = "zoomStretch",
                        
                        imageSuffix =
                                                {
                                                        ["@2"] = 1,
                                                }
                }
        }       
elseif system.getInfo("model") == "iPhone4" then
        application =
        {
                content =
                {
                        width = 768,
                        height = 1024,
                        fps = 60,
                        scale = "zoomStretch",
                        
                        imageSuffix =
                                                {
                                                        ["@2"] = 1,
                                                }
                }
        }   
else 
        application =
        {
                content =
                {
                        width = 768,
                        height = 1024,
                        fps = 60,
                        scale = "zoomStretch",
                        
                        imageSuffix =
                                                {
                                                        ["@2"] = 1,
                                                }
                }
        } 
end

I'm using this in my main.lua file (using director):

1
2
3
4
5
suffix = "" -- won't work local
 
if display.contentScaleX > 1.3 then -- iPhone 3 is "2.13", iPad and iPhone 4 "1.06" and "1". 
suffix = "@50"  -- your suffix @50= 50% for me
end

a slightly more modular way is to just insert an "imageName('ipadSizeimage')" function into all of your display.newImageRect( funcGoesHere() ) calls so you don't have to mess with changing specific calls if you learn a new trick later

views:1690 update:2011/10/2 9:44:12
corona forums © 2003-2011