playMaker

Author Topic: Scaling font in GUI button  (Read 3331 times)

gecko

  • Junior Playmaker
  • **
  • Posts: 52
Scaling font in GUI button
« on: August 02, 2013, 06:38:42 PM »
I'm using the GUI Button action, where I can set the buttons size as a percentage of screen width and height. Very nice. But the font does not scale accordingly, so the button text is just right on iPad 2 but very small on iPad 3. Is there a way to scale the font in the same way as the button?
 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Scaling font in GUI button
« Reply #1 on: August 06, 2013, 05:34:56 AM »
Hi,

 one way is to have two skins, one for non retina and one for retina. in there double the font sizes.

Would that do?

bye,

 Jean

gecko

  • Junior Playmaker
  • **
  • Posts: 52
Re: Scaling font in GUI button
« Reply #2 on: August 06, 2013, 09:39:38 AM »
Thanks for the reply -- yes, that'd work fine -- but how do I select the correct guiskin on the fly in a playmaker action?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Scaling font in GUI button
« Reply #3 on: August 06, 2013, 09:43:15 AM »
Hi,

 Simply check the size and make decisions based on that. Or get the device to begin with.

use "setGuiSkin" action to change the skin.


bye,

 Jean

gecko

  • Junior Playmaker
  • **
  • Posts: 52
Re: Scaling font in GUI button
« Reply #4 on: August 06, 2013, 10:03:28 AM »
Yeah, that's what I want to do, but I guess this requires more Playmaker expertise than I have -- I don't know how to set up that device or resolution detection (I see those actions, but don't know how to use them), in order to then trigger the appropriate guiskin. I understand that may be more help than the forum can offer.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Scaling font in GUI button
« Reply #5 on: August 07, 2013, 06:06:52 AM »
Hi,

 no problem. Please find a working sample.

basically, simply have a new guiskin ( you'll see that I imported the font manually, and set its size to 32, the retina guiskin is pointing to that font now)

I use the width of the screen to know if it is retina or not ( IT MEANS I EXPECT PORTRAIT ORIENTATION, AND IPHONE ONLY)

so if the width is more then 320 then it's retina and I set the guiskin to be the retina one.

You'll have to do more if you want to support ipad and various orientation, but that's the basic spirit.

as for the skin, you will also have to mess with values to get what you want for retina, but that's already tweaking.

bye,

 Jean


gecko

  • Junior Playmaker
  • **
  • Posts: 52
Re: Scaling font in GUI button
« Reply #6 on: August 07, 2013, 10:00:49 AM »
This is perfect! Thank you so much! And now I've learned how to do something new in PlayMaker as well. I really appreciate it!

Dave