• Bugs
  • Ablout view scale

Hi:
I want to ask some questions about view scale. On IOS devices, the scale 0.3f/0.2f/0.5f, How is it calculated?
I'm a rookie.help me!How to calculate dynamically the scale?

thanks!

Related Discussions
...
  • Изменено

When you export a skeleton from the Spine Editor, the coordinates are given in pixels. The scale you specify merely scales those pixel coordinates up or down, depending on the value.

You can query the pixel size of a skeleton at runtime, then set the scale of the skeleton accordingly. You can query the width and height via SkeletonAnimation->skeleton->data->width/height. You can then calculate the scale using the skeleton's width/height and the screen resolution, and set it on the SkeletonAnimation just like on any other Cocos2D node.