java - 旋转图集区域 Libgdx

标签 java image rotation libgdx atlas

protected TextureAtlas atlas = Assets.manager.get(Constants.ATLAS_PATH, TextureAtlas.class);

AtlasRegion region = interfaceAtlas.findRegion("arrow");

我加载了这样的图像 ( http://marinedealerconference.com/wp-content/uploads/2015/07/right.png ):一个指向右的箭头...

但是我找不到旋转它的方法! 我怎么能够?因为我希望它下降。

最佳答案

虽然可以旋转区域但不能旋转SpriteImage

    //sprite:
    public void rotate(float degrees)

    //image - remember to set origin to the center here!
    public void rotateBy(float amountInDegrees)

您可以“告诉”SpriteBatch 旋转区域来绘制它,而不是旋转区域本身:

    batch.draw(region, x, y, originX, originY, width, height, scaleX, scaleY, rotation);

关于java - 旋转图集区域 Libgdx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32870559/

相关文章:

Java:旋转图像使其指向鼠标光标

ios - UIView 动画/旋转时 UIButton 触摸位置不准确

java - ArrayList 上的 'X' 序列重复了多少次

java - 如何正确截断 double

java - 图像上弹出文本的 CSS 帮助

java - 放大URL图像尺寸

jquery:domready 或加载时的图像宽度?

java - 如何在eclipse galileo中配置struts?

iphone - UIScrollView问题

android - 如何在android中仅在横向模式下旋转显示?