簡體   English   中英

如何自動調整紋理的大小?

[英]How resize automatically textures?

我正在使用Libgdx,調整大小時紋理正確放置,但沒有調整大小。 我該如何解決?

我的代碼:

public void resize(int width, int height) {
        stage.setViewport(width, height, true);
        stage.getCamera().translate(-stage.getGutterWidth(),
                -stage.getGutterHeight(), 0);

        start.setPosition(stage.getWidth()/10f * 2f, stage.getHeight()/10f * 5f);
        soundOff.setPosition(stage.getWidth()/10f * 3.5f, stage.getHeight()/10f * 2f);
        soundOn.setPosition(stage.getWidth()/10f * 3.5f, stage.getHeight()/10f * 2);
        }

您只需更改其位置“ * .setPosition”,也可以設置其新大小。

暫無
暫無

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

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