@ansca: Why newRetinaText?

I must be missing something, but I can't understand why there's a distinction between regular text and hi-res "retina" text. IMHO text should always be displayed in the highest possible resolution on the device, and thus only one newText() function would be necessary.

What I'm using now to solve this issue is the following function, which is working well on all devices I've tested it on. It should also be future-proof whenever the iPad comes out with a high-res display as well.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Module.newText = function(str, xPos, yPos, font, size)        
        local scaleY = display.contentScaleY;
        local scaleFactor = 1.0;
        
        if (scaleY < 1.0) then
                scaleFactor = 1 / scaleY;
        end
        
        local text = display.newText(str, 0, 0, font, size * scaleFactor);
        
        text.xScale = scaleY;
        text.yScale = scaleY;
        text.x = xPos;
        text.y = yPos;
 
        return text;
end

thanks for code, its definitely be helpful

+1 Text should always render at its best on the device.

+1... I can't change how I set up my current project at this point, but it sure would be so helpful if text always render nice and crisp on various device without the need for manually coding/preparing for all possible outcome.

views:1422 update:2011/12/1 20:56:45
corona forums © 2003-2011