Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Rectangle


  private void renderEntity(Entity e, Graphics g, GameContainer container)
      throws SlickException {
    renderedEntities++;
    if (ME.debugEnabled && e.collidable) {
      g.setColor(ME.borderColor);
      Rectangle hitBox = new Rectangle(e.x + e.hitboxOffsetX, e.y
          + e.hitboxOffsetY, e.hitboxWidth, e.hitboxHeight);
      g.draw(hitBox);
      g.setColor(Color.white);
    }
    e.render(container, g);
View Full Code Here


   * @param x
   * @param y
   * @return true if an entity is already in position
   */
  public boolean isEmpty(int x, int y, int depth) {
    Rectangle rect;
    for (Entity entity : entities) {
      rect = new Rectangle(entity.x, entity.y, entity.width,
          entity.height);
      if (entity.depth == depth && rect.contains(x, y)) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    }
    return true;
  }

  public Entity find(int x, int y) {
    Rectangle rect;
    for (Entity entity : entities) {
      rect = new Rectangle(entity.x, entity.y, entity.width,
          entity.height);
      if (rect.contains(x, y)) {
        return entity;
      }
    }
    return null;
  }
View Full Code Here

    float width = Float.parseFloat(element.getAttribute("width"));
    float height = Float.parseFloat(element.getAttribute("height"));
    float x = Float.parseFloat(element.getAttribute("x"));
    float y = Float.parseFloat(element.getAttribute("y"));
   
    Rectangle rect = new Rectangle(x,y,width+1,height+1);
    Shape shape = rect.transform(transform);
   
    NonGeometricData data = Util.getNonGeometricData(element);
    data.addAttribute("width", ""+width);
    data.addAttribute("height", ""+height);
    data.addAttribute("x", ""+x);
View Full Code Here

      // screen
      this.cameraX = follow.x - (this.renderWidth / 2);
      this.cameraY = follow.y - (this.renderHeight / 2);
    }
    this.myWorld = world;
    this.visibleRect = new Rectangle(cameraX - horBorderPixel, cameraY
        - vertBorderPixel, renderWidth + horBorderPixel, renderHeight
        + vertBorderPixel);
    this.moveRect = new Rectangle(cameraX - horBorderPixel, cameraY
        - vertBorderPixel, renderWidth + horBorderPixel, renderHeight
        + vertBorderPixel);
    setCamera();
  }
View Full Code Here

        cameraY + vertBorderPixel / 2, renderWidth - horBorderPixel
            + follow.speed.x, renderHeight - vertBorderPixel);
  }

  public boolean contains(Entity e) {
    Rectangle entity = new Rectangle(e.x, e.y, e.width, e.height);
    return visibleRect.intersects(entity);
  }
View Full Code Here

     * @param hauteur La hauteur du bloc
     */
    public Bloc(int x, int y, int largeur, int hauteur) {
        this.map_x = x;
        this.map_y = y;
        forme = new Rectangle(x, y, largeur - 2, hauteur - 2);
    }
View Full Code Here

     * @param largeur La largeur (et aussi sa hauteur) du bloc
     */
    public Bloc(int x, int y, int largeur) {
        this.map_x = x;
        this.map_y = y;
        forme = new Rectangle(x, y, largeur - 2, largeur - 2);
    }
View Full Code Here

        this.perso_direction = direction;
        initialisation();
    }

    private void initialisation() throws SlickException, IOException {
        perso_contour = new Rectangle(0, 0, Jeu.CASE, Jeu.CASE);
        initAnimations();
        updateEcranX();
        updateEcranY();
    }
View Full Code Here

    calculateLine(one, two);
  }

  public void calculateLine(Entity one, Entity two) {
    float w = one.width;
    shape = new Rectangle(one.x, one.y, w, distance(one, two));
    float centerOneX = one.x + one.width / 2;
    float centerTwoX = two.x + two.width / 2;

    float centerOneY = one.y + one.height / 2;
    float centerTwoY = two.y + two.height / 2;
View Full Code Here

TOP

Related Classes of org.newdawn.slick.geom.Rectangle

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.