com.badlogic.gdx.scenes.scene2d.ui.Image.setWidth()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.setWidth()方法的一些代码示例,展示了Image.setWidth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Image.setWidth()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Image
类名称:Image
方法名:setWidth

Image.setWidth介绍

暂无

代码示例

代码示例来源:origin: langurmonkey/gaiasky

@Override
public void setWidth(float width) {
  ownwidth = width;
  super.setWidth(width);
}

代码示例来源:origin: dingjibang/GDX-RPG

/**使用整数坐标,以免导致纹理失真*/
public void setWidth(float width) {
  super.setWidth((int)width);
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

private void prepareBackgroundImage(AssetsInterface assets, float sizeMult) {
  TextureAtlas atlas = assets.getTextureAtlas(this.atlasName);
  this.backgroundImage = new Image(atlas.findRegion(this.backgroundImageFrame));
  this.backgroundImage.setWidth(this.backgroundImage.getWidth() * sizeMult);
  this.backgroundImage.setHeight(this.backgroundImage.getHeight() * sizeMult);
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

private void updateBackgroundImagePosition(Image image) {
  Vector2 selectedResolution = assets.findBestResolution();
  Vector2 backGroundSize = resolutionHelper.calculateBackgroundSize(selectedResolution.x, selectedResolution.y);
  image.setWidth(backGroundSize.x);
  image.setHeight(backGroundSize.y);
  Vector2 backGroundPosition = resolutionHelper.calculateBackgroundPosition(image.getWidth(), image.getHeight());
  Vector2 gameAreaPosition = resolutionHelper.getGameAreaPosition();
   /*
    * stage root position is always set to gameAreaPosition.
    * Since the bg image is also inside the root group, bg image position should be updated.
   */
  image.setPosition(backGroundPosition.x - gameAreaPosition.x, backGroundPosition.y - gameAreaPosition.y);
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

private Image createImage() {
    if (region == null) {
      region = game.getAssetsInterface()
          .getTextureAtlas("common.atlas").findRegion("accept_button");
    }
    
    Image image = new Image(region);
    image.setWidth(image.getMinWidth() * game.getResolutionHelper().getSizeMultiplier());
    image.setHeight(image.getMinHeight() * game.getResolutionHelper().getSizeMultiplier());
    return image;
  }
}

代码示例来源:origin: kbz/SIFTrain

splashImage.setWidth(stage.getWidth());
stage.addActor(splashImage);
titleLabel.setX(stage.getWidth() / 2 - titleLabel.getWidth() / 2);

代码示例来源:origin: kbz/SIFTrain

warnings = false;
backgroundImage.setHeight(stage.getHeight());
backgroundImage.setWidth(stage.getWidth());
stage.addActor(backgroundImage);

相关文章