Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Rectangle


   * @param other The other entity to check collision against
   * @return True if the entities collide with each other
   */
  public boolean collidesWith(Entity other) {
   
    Rectangle him = other.me;
   
    me.setBounds((int) x*32,(int) y*32,ENTITY_SPRITE_SIZE/2,ENTITY_SPRITE_SIZE/2);
   
    him.setBounds((int) other.getX()*32,(int) other.getY()*32,other.ENTITY_SPRITE_SIZE/2,other.ENTITY_SPRITE_SIZE/2);
   
    return me.intersects(him);
  }
View Full Code Here


  public static void spawn (XMLElement tag, int x, int y, GameMap m, String filepath) throws SlickException {
    int multiplyBy = 16;
    if (tag.getBooleanAttribute("absolutePosition", false)) {
      multiplyBy = 1;
    }
    Rectangle boundingBox = new Rectangle((x*multiplyBy)+tag.getIntAttribute("offsetX", 0), (y*multiplyBy)+tag.getIntAttribute("offsetY", 0), tag.getIntAttribute("width", 15), tag.getIntAttribute("height", 15));
   
    EntityPhase[] phases = new EntityPhase[tag.getChildrenByName("phase").size()];
    for (int h=0; h < phases.length; h++) {
      phases[h] = buildPhase(tag.getChildrenByName("phase").get(h));
    }
View Full Code Here

    public Controller(AbstractEntity e, float x, float y){
  this.entity = e;
  this.x = x;
  this.y = y;
        this.accelerate = new Vector2f(0,0);
  this.hitbox = new Rectangle((int)this.x,(int)this.y,(int)this.entity.getElement().getSpriteSizeX(),(int)this.entity.getElement().getSpriteSizeY());
  if(CONF.debugLevel >= 3)
      System.out.println("[DEBUG] X = "+(int)this.x+" ; Y = "+(int)this.y+" ; SX = "+(int)this.entity.getElement().getSpriteSizeX()+" ; SY = "+(int)this.entity.getElement().getSpriteSizeY()+" ; ");
    }
View Full Code Here

   * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
   */
  public void init(GameContainer container) throws SlickException {
    this.container = container;
 
    rect = new Rectangle(400,100,200,150);
    round = new RoundedRectangle(150,100,200,150,50);
    round2 = new RoundedRectangle(150,300,200,150,50);
    center = new Rectangle(350,250,100,100);
   
    poly = new Polygon();
    poly.addPoint(400,350);
    poly.addPoint(550,320);
    poly.addPoint(600,380);
View Full Code Here

   * @param height
   *            The height of the area
   */
  public MouseOverArea(GUIContext container, Image image, int x, int y,
      int width, int height) {
    this(container,image,new Rectangle(x,y,width,height));
  }
View Full Code Here

      if (scale != 1.0f)
        g.resetTransform();
    }
    if (ME.debugEnabled && collidable) {
      g.setColor(ME.borderColor);
      Rectangle hitBox = new Rectangle(x + hitboxOffsetX, y
          + hitboxOffsetY, hitboxWidth, hitboxHeight);
      g.draw(hitBox);
      g.setColor(Color.white);
      g.drawRect(x, y, 1, 1);
      // draw entity center
View Full Code Here

    if (shape == null)
      return null;
    List<Entity> result = new ArrayList<Entity>();
    for (Entity entity : world.getEntities()) {
      if (entity.collidable && !entity.equals(this)) {
        Rectangle rec = new Rectangle(entity.x, entity.y, entity.width,
            entity.height);
        if (shape.intersects(rec)) {
          result.add(entity);
        }
      }
View Full Code Here

   * @param height
   *            The height of the allowed area
   */
  public void setWorldClip(float x, float y, float width, float height) {
    predraw();
    worldClipRecord = new Rectangle(x, y, width, height);
   
    GL.glEnable(SGL.GL_CLIP_PLANE0);
    worldClip.put(1).put(0).put(0).put(-x).flip();
    GL.glClipPlane(SGL.GL_CLIP_PLANE0, worldClip);
    GL.glEnable(SGL.GL_CLIP_PLANE1);
View Full Code Here

  public void setClip(int x, int y, int width, int height) {
    predraw();
   
    if (clip == null) {
      GL.glEnable(SGL.GL_SCISSOR_TEST);
      clip = new Rectangle(x, y, width, height);
    } else {
      clip.setBounds(x,y,width,height);
    }
   
    GL.glScissor(x, screenHeight - y - height, width, height);
View Full Code Here

  public void fillRect(float x, float y, float width, float height,
      Image pattern, float offX, float offY) {
    int cols = ((int) Math.ceil(width / pattern.getWidth())) + 2;
    int rows = ((int) Math.ceil(height / pattern.getHeight())) + 2;

    Rectangle preClip = getWorldClip();
    setWorldClip(x, y, width, height);

    predraw();
    // Draw all the quads we need
    for (int c = 0; c < cols; c++) {
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.