com.badlogic.gdx.scenes.scene2d.Actor.setScale()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(127)

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

Actor.setScale介绍

[英]Sets the scale for both X and Y
[中]设置X和Y的比例

代码示例

代码示例来源:origin: libgdx/libgdx

protected void update (float percent) {
  target.setScale(startX + (endX - startX) * percent, startY + (endY - startY) * percent);
}

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

protected void setScaleProperty(BaseModel model, Actor actor) {
  if (model.getScale() != 1) {
    actor.setScale(model.getScale(), model.getScale());
  } else {
    actor.setScaleX(model.getScaleX());
    actor.setScaleY(model.getScaleY());
  }
}

代码示例来源:origin: libgdx/libgdx

protected void update (float percent) {
  target.setScale(startX + (endX - startX) * percent, startY + (endY - startY) * percent);
}

代码示例来源:origin: libgdx/libgdx

sprite.setScale(scale);
} else {
  sprite.setScale(1);

代码示例来源:origin: libgdx/libgdx

private Group createActorGroup (TextureRegionDrawable bob) {
  Actor main = new DrawableActor(bob);
  main.setPosition(0, 0, Align.center);
  Actor hat = new DrawableActor(bob) {
    @Override
    public void act (float delta) {
      rotateBy(delta * -300);
    }
  };
  hat.setOrigin(Align.center);
  hat.setScale(0.5f);
  hat.setPosition(0, 21, Align.center);
  Group group = new Group() {
    @Override
    public void act (float delta) {
      rotateBy(delta * 120);
      setScale(0.9f + 0.2f * MathUtils.cos(MathUtils.degreesToRadians * getRotation()));
      super.act(delta);
    }
  };
  group.addActor(main);
  group.addActor(hat) ;
  // group.setTransform(false);
  float margin = 35;
  float x = MathUtils.random(margin, stage.getWidth() - margin);
  float y = MathUtils.random(margin, stage.getHeight() - margin);
  group.setPosition(x, y);
  group.setRotation(MathUtils.random(0, 360));
  return group;
}

代码示例来源:origin: moribitotech/MTX

/**
 * Set scale of multiple actors at once
 * */
public static void setScale(float sx, float sy, Actor... actors) {
  for (Actor a : actors) {
    a.setScale(sx, sy);
  }
}

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

public TypedGdxQuery<T> scale(float scaleXY){
  t.setScale(scaleXY);
  return this;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

protected void update (float percent) {
  target.setScale(startX + (endX - startX) * percent, startY + (endY - startY) * percent);
}

代码示例来源:origin: Var3D/var3dframe

public UI<T> setScale(float scale) {
  t.setScale(scale);
  return this;
}

代码示例来源:origin: Var3D/var3dframe

public UI<T> setScale(float scaleX, float scaleY) {
  t.setScale(scaleX, scaleY);
  return this;
}

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

private void resizeActor(Actor actor, float sizeMultiplier) {
  actor.setScale(sizeMultiplier);
}

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

public GdxQuery scale(float scaleXY){
  for(Actor actor:list())
    actor.setScale(scaleXY);
  return this;
}

代码示例来源:origin: dsaltares/libgdx-cookbook

@Override
  public void setValues(Actor target, int tweenType, float[] newValues) {
    switch (tweenType) {

    case POS_XY: target.setPosition(newValues[0], newValues[1]); break;

    case CPOS_XY: target.setPosition(newValues[0] - target.getWidth()*.5f, newValues[1] - target.getHeight()*.5f); break;

    case SCALE_XY: target.setScale(newValues[0], newValues[1]); break;

    case ROTATION: target.setRotation(newValues[0]); break;

    case OPACITY:
      Color c = target.getColor();
      c.set(c.r, c.g, c.b, newValues[0]);
      target.setColor(c);
      break;

    case TINT:
      c = target.getColor();
      c.set(newValues[0], newValues[1], newValues[2], c.a);
      target.setColor(c);
      break;

    default: assert false;
    }
  }
}

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

actor.setScale(widget.getScale().getScaleX(), widget.getScale()
    .getScaleY());

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

actor.setScale(1, 1);
table.addActorAt(0, actor);
return table;

相关文章