Exemple #1
0
  public OpacitySpriteEdit(LevelMap map, double opacity, boolean isRelative) {
    super();
    this.map = map;

    sprites = new ArrayList(map.selectedSprites);

    // save the sprites' old opacity
    for (int i = 0; i < sprites.size(); i++) {
      SpriteInstance sprite = sprites.get(i);
      oldOpacities.add(sprite.opacity);
    }

    // change the sprites' opacity and save their new opacity
    for (int i = 0; i < sprites.size(); i++) {
      SpriteInstance sprite = sprites.get(i);

      if (isRelative) sprite.opacity *= opacity;
      else sprite.opacity = opacity;
      sprite.setOpacity(sprite.opacity);

      newOpacities.add(sprite.opacity);
    }

    map.flagModified();
  }
Exemple #2
0
  public void redo() {
    for (int i = 0; i < sprites.size(); i++) {
      SpriteInstance sprite = sprites.get(i);
      sprite.opacity = newOpacities.get(i);
    }

    map.flagModified();
  }
Exemple #3
0
  public DropSpriteEdit(LevelMap map, SpriteType spriteType, Point loc) {
    super();
    this.map = map;
    this.spriteType = spriteType;
    this.loc = loc;
    this.layer = map.selectedLayer;

    sprite = layer.dropSpriteType(spriteType, loc);

    map.flagModified();
  }
Exemple #4
0
  public void redo() {
    layer.addSprite(sprite);
    sprite.isSelected = false;

    map.flagModified();
  }
Exemple #5
0
  public void undo() {
    layer.removeSprite(sprite);
    sprite.isSelected = false;

    map.flagModified();
  }