如何计算Sprite的尺寸? [英] How to calculate the size of a sprite?

查看:211
本文介绍了如何计算Sprite的尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个精灵,我做一些自定义绘制的,但我想容器知道正确定位精灵。要做到这一点,容器需要知道有多大的精灵是。的UIComponents经过一个阶段的措施,但精灵没有。如何计算的大小,一个精灵会是谁?

I have a sprite that I do some custom drawing in, but I would like the container to know where to position the sprite properly. To do this, the container needs to know how big the sprite is. UIComponents go through a measure stage, but sprites don't . How do I calculate the size that a sprite will be?

编辑:我做的Event.ENTER_FRAME绘图,它的动画,这样的时候,我不能提前告诉有多大这将是。 UIComponent具有测量功能,我想创建类似的东西。

I'm doing the drawing in Event.ENTER_FRAME, and it's animated, so I can't tell ahead of time how big it's going to be. The UIComponent has a measure function and I'd like to create something similar.

推荐答案

在precise的回答,据我所知,你不能告诉提前,你必须实际绘制成的精灵,以确定它的大小。

The precise answer, as far as I can gather is, you can't tell ahead of time, you must actually draw into the sprite to determine it's size.

这篇关于如何计算Sprite的尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆