What does retina-aware mean?

Hi all,

I just got around to trying newRetinaText only to get a message in the terminal that it has been deprecated because newText is now retina-aware. I don’t like assumptions, bus since I can’t find any documentation clarifying what this means, I’m wondering if anyone has experience with how the newText function behaves on the full spectrum of devices? (I only have an iPad 1) to play with.

I have been multiplying the size by 2 and scaling it down by 0.5 (a hack given by Cheetomoskeeto). Does this mean I can stop doing that and the SDK will automatically scale it based on the device it’s running on? Maybe I’m just missing where this is documented…

thanks much!
Chris
[import]uid: 97836 topic_id: 27485 reply_id: 327485[/import]

I believe so - haven’t looked into it too much myself as soon as I switched over to bitmap fonts, but I believe that’s the case.

Sure somebody will shoot me down if it’s wrong :slight_smile: [import]uid: 33275 topic_id: 27485 reply_id: 111676[/import]

I believe so - haven’t looked into it too much myself as soon as I switched over to bitmap fonts, but I believe that’s the case.

Sure somebody will shoot me down if it’s wrong :slight_smile: [import]uid: 33275 topic_id: 27485 reply_id: 111677[/import]

I also wonder this… [import]uid: 5629 topic_id: 27485 reply_id: 111678[/import]

This is one of those magic things. Just use display.newText() and forget that retinaText ever existed.

The display.newText() currently in the daily builds will scale the text properly depending on the device without you doing anything.

There is one gotcha to be aware of though. If your text is so big that it’s texture size exceeds the max texture size for the device, you will get solid color blocks instead of text. [import]uid: 19626 topic_id: 27485 reply_id: 111692[/import]

Chris@cpalmer5219, @SegaBoy and @yagizgurgul, I use custom fonts, and I used to use newRetinaText. Then when newText was updated, I switched over, and it works perfectly fine (sharp text) on all iOS devices I tried (including New iPad). It will automatically scale to work with the screen resolution of the device (just like newRetinaText did.)

Naomi [import]uid: 67217 topic_id: 27485 reply_id: 111693[/import]

The advice given is correct.

From the latest daily builds and the next public release display.newText automatically sets the text size for retina devices [import]uid: 84637 topic_id: 27485 reply_id: 111707[/import]

Thank you all for your responses to this question - I’m happy to know I can stop with the extra code now.

While we’re talking about text, I’ve been having trouble applying setReferencePoint(display.BottomLeftReferencePoint) in an attempt to left justify a text object. This is based, of course, on another assumption - that text behaves just like any other object. Would love to hear everyone’s experience with this too.

Many thanks,
Chris [import]uid: 97836 topic_id: 27485 reply_id: 111713[/import]

Hey, Chris@cpalmer5219, take a look at this FAQ post (question #2):

http://www.coronalabs.com/blog/2012/06/13/faq-wednesday-7/

The bottom line is that, the safest thing to do is to set your x/y coordinate after you set the reference point and the text (or at least that’s what I do anyhow).

If you are using CenterReferencePoint, you don’t need to reset the reference point or x/y coordinate, though.

Naomi [import]uid: 67217 topic_id: 27485 reply_id: 111718[/import]

Any information regarding when the next public release Will be released? :slight_smile: [import]uid: 122802 topic_id: 27485 reply_id: 111735[/import]

Hi @Naomi,

Thanks so much for the info. I appreciate it :slight_smile:

chris [import]uid: 97836 topic_id: 27485 reply_id: 111749[/import]

For anyone that might be reading this in the future: setting the reference point first followed by setting the x/y coordinates worked like a charm.

However… if the text changes, you have to re-declare the reference point and x/y every time a change takes place or it reverts back to the center reference point. [import]uid: 97836 topic_id: 27485 reply_id: 111753[/import]

Yes, which is why frequently I recommend coding functions to handle that problem! :wink:

ie: If you want to update the text on a UI object…

[code]local function coolVisObject()
– Make your display object
local group = display.newGroup()
local text1 = display.newText(group, 32, 0, 0, native.systemFont, 20)
text1:setReferencePoint(display.CenterRightReferencePoint)
local text2 = display.newText(group, “/99”, 0, 0, native.systemFont, 20)
text2:setReferencePoint(display.CenterLeftReferencePoint)
text2.x, text2.y = text1.x, text1.y

– Make a shortcut function to update it!
function group:change(number)
text1.text = number
text1:setReferencePoint(display.CenterRightReferencePoint)
text1.x, text1.y = text2.x, text2.y
end

return group
end

local UIobject = coolVisObject()
UIobject:change(82)
[/code]

Calling sub functions like that one makes it much easier and clearer to deal with reference points, as frequently you need to use a *lot* of them. (I hope that future update with RP setting within the function call happens, but I can see how forcing users to use it outside is a good habit to learn…) [import]uid: 41884 topic_id: 27485 reply_id: 111762[/import]