libgdx中缩放后Sprite的宽度和高度

时间:2015-04-14 14:21:55

标签: android libgdx

我将精灵缩放到70%,然后我测量了精灵的宽度和高度。屏幕尺寸减小但是当我使用getWidth()或getRegionWidth()检查宽度和高度时,宽度保持不变。

请在缩放后帮助我获取精灵的宽度和高度

    System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Before Scale");
    System.out.println("popUpSprite.getWidth() " + popUpSprite.getWidth());
    System.out.println("popUpSprite.getHeight() " + popUpSprite.getHeight());
    System.out.println("popUpSprite.getRegionWidth() " + popUpSprite.getRegionWidth());
    System.out.println("popUpSprite.getRegionHeight() " + popUpSprite.getRegionHeight()); 
    popUpSprite.setScale(.7f); 
    System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!After Scale");
    System.out.println("popUpSprite.getWidth() " + popUpSprite.getWidth());
    System.out.println("popUpSprite.getHeight() " + popUpSprite.getHeight());
    System.out.println("popUpSprite.getRegionWidth() " + popUpSprite.getRegionWidth());
    System.out.println("popUpSprite.getRegionHeight() " + popUpSprite.getRegionHeight()); 

logcat的

04-14 19:44:33.908: I/System.out(18918): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Before Scale
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getWidth() 1000.0
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getHeight() 1400.0
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getRegionWidth() 1000
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getRegionHeight() 1400
04-14 19:44:33.908: I/System.out(18918): !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    After Scale
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getWidth() 1000.0
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getHeight() 1400.0
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getRegionWidth() 1000
04-14 19:44:33.908: I/System.out(18918): popUpSprite.getRegionHeight() 1400

0 个答案:

没有答案