示例#1
0
  /**
   * @param group an empty group to be the parent
   * @return the group with the current selection
   */
  public Group createGroup(Group group) {
    // New group has the same transformation as this
    group.setBounds(getX(), getY(), getWidth(), getHeight());
    group.setOrigin(getOriginX(), getOriginY());
    group.setRotation(getRotation());
    group.setScale(getScaleX(), getScaleY());

    // Each children in the group must be contained by the new group
    Array<Actor> children = getChildren();
    children.sort(
        new Comparator<Actor>() {
          @Override
          public int compare(Actor actor, Actor actor2) {
            return ((SelectionGhost) actor).getRepresentedActor().getZIndex()
                - ((SelectionGhost) actor2).getRepresentedActor().getZIndex();
          }
        });

    for (Actor actor : children) {
      SelectionGhost ghost = (SelectionGhost) actor;
      Actor representedActor = ghost.getRepresentedActor();
      representedActor.setPosition(ghost.getX(), ghost.getY());
      representedActor.setRotation(ghost.getRotation());
      representedActor.setScale(ghost.getScaleX(), ghost.getScaleY());
      group.addActor(representedActor);
    }
    return group;
  }
示例#2
0
  @Override
  public void create() {
    FileHandle fh = Gdx.files.internal("freud.txt");
    TextureAtlas atlas = new TextureAtlas(fh);
    stage = new Stage();

    // ======= フロイト ==========
    TextureAtlas.AtlasRegion fruedRegion = atlas.findRegion("nigaoe_freud");
    // Imageクラスにregionを食わせるらしい
    Image fruedImage = new Image(fruedRegion);
    fruedImage.setPosition(0, 0);

    // ステージにActorを突っ込む
    // Imageはextends Widget。
    // Widgetはextends Actor implementes Layout
    stage.addActor(fruedImage); // stageの直下に追加

    // ======= 始皇帝 ==========
    TextureAtlas.AtlasRegion shikouteiRegion = atlas.findRegion("nigaoe_shikoutei");
    Image shikouteiImage = new Image(shikouteiRegion);
    shikouteiImage.setPosition(200, 0);
    stage.addActor(shikouteiImage); // stageの直下に追加

    // グループを生成する
    // Groupもextends Actor implemnts Cullable
    // Cullableはよく分からん
    // 多分Groupのabilityなんだと思うんだが
    // 親子関係の描画操作かな
    Group group = new Group();
    group.setPosition(150, 200);
    group.setScale(0.5f);
    stage.addActor(group);

    // ======= 正岡子規 ==========
    TextureAtlas.AtlasRegion masaokaRegion = atlas.findRegion("nigaoe_masaoka_shiki");
    Image masaokaImage = new Image(masaokaRegion);
    masaokaImage.setPosition(0, 0);
    group.addActor(masaokaImage); // groupの下に追加

    // ======= 石川ゴエモン ==========
    TextureAtlas.AtlasRegion goemonRegion = atlas.findRegion("nigaoe_ishikawa_goemon");
    Image goemonImage = new Image(goemonRegion);
    goemonImage.setPosition(200, 0);
    group.addActor(goemonImage); // groupの下に追加
  }
示例#3
0
 @Override
 public void setScale(float scaleXY) {
   super.setScale(scaleXY);
   modified = true;
 }