Package ch.fusun.baron.property.ui

Source Code of ch.fusun.baron.property.ui.PropertyTileChild

package ch.fusun.baron.property.ui;

import ch.fusun.baron.map.ui.gef.editpart.TileChild;
import ch.fusun.baron.player.Dynasty;
import ch.fusun.baron.swt.isometry.components.Sprite;

/**
* The property tile child (for borders)
*/
public class PropertyTileChild implements TileChild<Dynasty> {

  private final int index;

  /**
   * @param i
   *            the index
   */
  public PropertyTileChild(int i) {
    this.index = i;
  }

  @Override
  public Dynasty getModel() {
    return null; // can't be selected anyway
  }

  @Override
  public Sprite getSprite() {
    return new Sprite(Activator.getBorderImage(index),
        Activator.getBorderImage(turn90(index)),
        Activator.getBorderImage(turn90(turn90(index))),
        Activator.getBorderImage(turn90(turn90(turn90(index)))), 15);
  }

  private static int turn90(int index) {
    return ((2 * (index & 15)) & 15) + ((index & 8) / 8);
  }

}
TOP

Related Classes of ch.fusun.baron.property.ui.PropertyTileChild

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.