簡體   English   中英

旋轉阿特拉斯地區Libgdx

[英]Rotate Atlas Region Libgdx

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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM