Game Development Community

Universal Gui controls in 1.5?

by Joe O · in iTorque 2D · 10/10/2011 (9:00 am) · 7 replies

Porting my project to 1.5 has gone fairly well except for one thing. My gui's aren't sized properly. What's the recommended approach to fix this? Should I do one of the following or is there another method that all the cool kids are using?

Also, if there's a resource that covers this topic please feel free to drop me a link - I probably missed it if that's the case.

a) After calling setResolution, set all my gui extents to the mainScreen gui extents?
-- Only problem I see with this approach is all my controls will remain in the same position.
-- I'd want them to be arranged on the screen relative to the position defined from their source.

b) Have each gui use different platform targets?
-- Even I get copy and paste wrong sometimes but if this is what it's for... I'll use it.

Thanks!

#1
10/10/2011 (2:53 pm)
You have to go with option 'b' and adjust for the different platforms.

#2
10/10/2011 (3:39 pm)
what I did was set all the sizing to Relative.
#3
10/11/2011 (7:15 am)
Thanks! Relative sizing was just what I needed :)
#4
10/11/2011 (8:57 pm)
You are welcome, but i have been having gui problems too. Do you know of any reason why my gui text would appear as boxes per character on an ios device, but look fine when ran threw itorque?
#5
10/11/2011 (9:48 pm)
the only reason I know would be text created by code and not having the letters used anywhere 'static' thus the letters will not be created for the bitmap font. And as the bitmap font will NEVER be generated on device, only on the computer, it then just is not there leading to a 'non letter'
#6
10/12/2011 (8:59 pm)
how could i fix that?
#7
01/21/2012 (8:43 am)
I just wanted to touch base on this thread again and add one more point...

I've switched all of my controls to relative sizing and my fonts are either one size or another:

fontSize = ( $platform $= "iphone" ) ? 18 : 36;

It's working out really well for dealing with iphone vs ipad & retina.