Package games.stendhal.client.sprite

Examples of games.stendhal.client.sprite.SpriteStore


  /**
   * Build the visual representation of this entity.
   */
  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    Sprite sprite = store.getSprite(translate(getClassResourcePath()));
    setSprite(sprite);
  }
View Full Code Here


   * Populate named state sprites.
   *
   */
  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    final Sprite tiles = store.getSprite(translate(getClassResourcePath()));

    working = store.getTile(tiles, 0, 0, IGameScreen.SIZE_UNIT_PIXELS,
        IGameScreen.SIZE_UNIT_PIXELS);
    broken = store.getTile(tiles, 0, IGameScreen.SIZE_UNIT_PIXELS,
        IGameScreen.SIZE_UNIT_PIXELS, IGameScreen.SIZE_UNIT_PIXELS);

    setSprite(getStateSprite());
    stateChanged = false;
  }
View Full Code Here

  /**
   * Build the visual representation of this entity.
   */
  @Override
  protected void buildRepresentation(IEntity entity) {
    final SpriteStore store = SpriteStore.get();
    Sprite sprite = store.getSprite(translate(getClassResourcePath()));

    /*
     * Items are always 1x1 (they need to fit in entity slots). Extra
     * columns are animation. Extra rows are ignored.
     */
    final int width = sprite.getWidth();

    if (width > IGameScreen.SIZE_UNIT_PIXELS) {
      sprite = store.getAnimatedSprite(sprite, 0, 0, width
          / IGameScreen.SIZE_UNIT_PIXELS,
          IGameScreen.SIZE_UNIT_PIXELS, IGameScreen.SIZE_UNIT_PIXELS,
          100);
    } else if (sprite.getHeight() > IGameScreen.SIZE_UNIT_PIXELS) {
      sprite = store.getTile(sprite, 0, 0, IGameScreen.SIZE_UNIT_PIXELS,
          IGameScreen.SIZE_UNIT_PIXELS);
      logger.warn("Multi-row item image for: " + getClassResourcePath());
    }

    setSprite(sprite);
View Full Code Here

   */
  @Override
  protected void buildSprites(IEntity entity, final Map<Object, Sprite> map) {
    final String name = entity.getEntityClass();

    final SpriteStore store = SpriteStore.get();

    if (name == null) {
      width = IGameScreen.SIZE_UNIT_PIXELS;
      height = IGameScreen.SIZE_UNIT_PIXELS;

      final Sprite emptySprite = store.getEmptySprite(width, height);

      map.put(STATE_OPEN, emptySprite);
      map.put(STATE_CLOSED, emptySprite);
    } else {
      final Sprite tiles = store.getSprite(translate(name));

      width = tiles.getWidth();
      height = tiles.getHeight() / 2;

      map.put(STATE_OPEN, store.getTile(tiles, 0, 0, width, height));
      map.put(STATE_CLOSED, store
          .getTile(tiles, 0, height, width, height));
    }

    calculateOffset(entity, width, height);
  }
View Full Code Here

   * Create a new BackgroundPainter.
   *
   * @param image image name. The image should be of size 96x96.
   */
  public BackgroundPainter(String image) {
    SpriteStore store = SpriteStore.get();
    Sprite mother = store.getSprite(image);
    images = new Sprite[9];
    int i = 0;
    for (int y = 0; y < 3 * TILE_SIZE; y += TILE_SIZE) {
      for (int x = 0; x < 3 * TILE_SIZE; x += TILE_SIZE) {
        images[i] = store.getTile(mother, x, y, TILE_SIZE, TILE_SIZE);
        i++;
      }
    }
  }
View Full Code Here

     *
     * Add filler to shift the hand slots down. Shift * 2 because centering
     * the column uses the other half at the bottom.
     */
    left.add(Box.createVerticalStrut(HAND_YSHIFT * 2));
    SpriteStore store = SpriteStore.get();
    ItemPanel panel = new ItemPanel("rhand", store.getSprite("data/gui/weapon-slot.png"));
    slotPanels.put("rhand", panel);
    left.add(panel);
   
    panel = new ItemPanel("finger", store.getSprite("data/gui/ring-slot.png"));
    slotPanels.put("finger", panel);
    left.add(panel);
   
    // Fill the middle column
    panel = new ItemPanel("head", store.getSprite("data/gui/helmet-slot.png"));
    slotPanels.put("head", panel);
    middle.add(panel);
   
    panel = new ItemPanel("armor", store.getSprite("data/gui/armor-slot.png"));
    slotPanels.put("armor", panel);
    middle.add(panel);
   
    panel = new ItemPanel("legs", store.getSprite("data/gui/legs-slot.png"));
    slotPanels.put("legs", panel);
    middle.add(panel);
   
    panel = new ItemPanel("feet", store.getSprite("data/gui/boots-slot.png"));
    slotPanels.put("feet", panel);
    middle.add(panel);
 
    /*
     *  Fill the right column
     *
     * Add filler to shift the hand slots down. Shift * 2 because centering
     * the column uses the other half at the bottom.
     */
    right.add(Box.createVerticalStrut(HAND_YSHIFT * 2));
    panel = new ItemPanel("lhand", store.getSprite("data/gui/shield-slot.png"));
    slotPanels.put("lhand", panel);
    right.add(panel);
   
    panel = new ItemPanel("cloak", store.getSprite("data/gui/cloak-slot.png"));
    slotPanels.put("cloak", panel);
    right.add(panel);
   
    setContent(row);
  }
View Full Code Here

  public WoodStyle() {
    /*
     * Load the texture
     */
    final SpriteStore st = SpriteStore.get();
    background = st.getSprite("data/gui/panelwood119.jpg");

    border = new PixmapBorder(background, true);
    borderDown = new PixmapBorder(background, false);

    font = new Font("Dialog", Font.PLAIN, 12);
View Full Code Here

TOP

Related Classes of games.stendhal.client.sprite.SpriteStore

Copyright © 2018 www.massapicom. 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.