Examples of Sprite


Examples of games.stendhal.client.sprite.Sprite

   *
   * @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);
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * @param width width of the painted area
   * @param height height of the painted area
   */
  public void paint(Graphics g, int width, int height) {
    // Paint the center part. That covers the whole area
    Sprite sprite = images[4];
    for (int y = 0; y < height; y += TILE_SIZE) {
      for (int x = 0; x < width; x += TILE_SIZE) {
        sprite.draw(g, x, y);
      }
    }
    // Sides
    // Top row.
    sprite = images[1];
    for (int x = TILE_SIZE; x < width - TILE_SIZE; x += TILE_SIZE) {
      sprite.draw(g, x, 0);
    }
    // left side
    sprite = images[3];
    for (int y = TILE_SIZE; y < height - TILE_SIZE; y += TILE_SIZE) {
      sprite.draw(g, 0, y);
    }
    /*
     * The rest of the sides will not tile properly, but the background
     * pattern is subtle enough that it will not be immediately noticeable.
     */
    // right side
    sprite = images[5];
    // Do not draw over the left side, but let the scroll overflow from the
    // right if there's no space
    int rightX = Math.max(width - TILE_SIZE, TILE_SIZE);
    for (int y = TILE_SIZE; y < height - TILE_SIZE; y += TILE_SIZE) {
      sprite.draw(g, rightX, y);
    }
    // bottom
    sprite = images[7];
    // Do not draw over the top border, but let the scroll overflow from the
    // bottom if there's no space
    int bottomY = Math.max(height - TILE_SIZE, TILE_SIZE);
    for (int x = TILE_SIZE; x < width - TILE_SIZE; x += TILE_SIZE) {
      sprite.draw(g, x, bottomY);
    }
   
    // Corners. Again, only the first one will tile properly
    // Top left corner
    sprite = images[0];
    sprite.draw(g, 0, 0);
    // Top right corner
    sprite = images[2];
    sprite.draw(g, rightX, 0);
    // Bottom left corner
    sprite = images[6];
    sprite.draw(g, 0, bottomY);
    // Bottom right corner
    sprite = images[8];
    sprite.draw(g, rightX, bottomY);
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * Draws a hair images from an outfit code.
   * @param code
   * @param g
   */
  private void drawHair(final int code, final Graphics g) {
    final Sprite sprite = store.getTile(ostore.getHairSprite(code), PLAYER_WIDTH,
        direction * PLAYER_HEIGHT, PLAYER_WIDTH, PLAYER_HEIGHT);

    sprite.draw(g, 2, 2);
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * Draws a head from the outfit code.
   * @param code
   * @param g
   */
  private void drawHead(final int code, final Graphics g) {
    final Sprite sprite = store.getTile(ostore.getHeadSprite(code), PLAYER_WIDTH,
        direction * PLAYER_HEIGHT, PLAYER_WIDTH, PLAYER_HEIGHT);

    sprite.draw(g, 2, 2);
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * Draws a dress from the outfit code.
   * @param code
   * @param g
   */
  private void drawDress(final int code, final Graphics g) {
    final Sprite sprite = store.getTile(ostore.getDressSprite(code),
        PLAYER_WIDTH, direction * PLAYER_HEIGHT, PLAYER_WIDTH,
        PLAYER_HEIGHT);

    sprite.draw(g, 2, 2);
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * Draws a base from an outfit code.
   * @param code
   * @param g
   */
  private void drawBase(final int code, final Graphics g) {
    final Sprite sprite = store.getTile(ostore.getBaseSprite(code), PLAYER_WIDTH,
        direction * PLAYER_HEIGHT, PLAYER_WIDTH, PLAYER_HEIGHT);

    sprite.draw(g, 2, 2);
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

      int y, int width, int height) {
    // Prepare clipping
    graphics = graphics.create();
    graphics.clipRect(x, y, width, height);
   
    Sprite image = style.getBackground();
   
    for (int i = x; i < x + width; i += image.getWidth()) {
      for (int j = y; j < y + height; j += image.getHeight()) {
        image.draw(graphics, i, j);
      }
    }
    graphics.dispose();
  }
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * @see games.stendhal.common.NotificationType
   */
  void addText(final double x, final double y, final String text, final NotificationType type,
      final boolean isTalking) {
    // createTextBox is thread safe, the rest is not
    final Sprite sprite = screen.createTextBox(text, type, isTalking);
    final int textLength = text.length();
   
    if (!isTalking) {
      SwingUtilities.invokeLater(new Runnable() {
        public void run() {
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

   * @param description
   * @param category
   */
  public void addAchievementBox(String title, String description,
      String category) {
    final Sprite sprite = getAchievementFactory().createAchievementBox(title, description, category);
   
    /*
     * Keep the achievements a bit longer on the screen. They do not leave
     * a line to the chat log, so we give the player a bit more time to
     * admire her prowess.
View Full Code Here

Examples of games.stendhal.client.sprite.Sprite

     */
    final TilesetAnimationMap tsam = animationMap.get(ref);

    if (tsam != null) {
      for (int i = 0; i < size; i++) {
        final Sprite sprite = tsam.getSprite(tileset, i);

        if (sprite != null) {
          tiles.set(baseindex + i, sprite);
        }
      }
View Full Code Here
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.