Package general.datastructures

Examples of general.datastructures.Rectangle


    {
      if(s.equals(this))
      {
        continue;
      }
      if(s.getCollisionRectangle().intersects(new Rectangle(wc_targetpos, getWidth(), getHeight())))
      {
        System.out.println("Kollision: "+this.getName()+" ist mit "+s.getName()+" kollidiert!");
        collidingSprites.add(s);
      }
    }
View Full Code Here


  }
 
  @Test
  public void testRectangle()
  {
    Rectangle r;
    r = new Rectangle(2, 3, 4, 5);
    assertNotNull(r);
    assertEquals(2, r.getLeft(),0.0001);
    assertEquals(3, r.getRight(),0.0001);
    assertEquals(4, r.getTop(),0.0001);
    assertEquals(5, r.getBottom(),0.0001);
  }
View Full Code Here

    return this.wc_position;
  }
 
  public Rectangle getCollisionRectangle()
  {
    return new Rectangle(this.wc_position,this.getWidth(),this.getHeight());
  }
View Full Code Here

    return Vector2f.subtract(vec, viewport.getOrigin());
  }
 
  public static Rectangle worldToScreen(Rectangle rec, Rectangle viewport)
  {
    return new Rectangle(Vector2f.subtract(rec.getOrigin(),viewport.getOrigin()), rec.getWidth(), rec.getHeight());
  }
View Full Code Here

    return vec.add_cpy(viewport.getOrigin());
  }
 
  public static Rectangle screenToWorld(Rectangle rec, Rectangle viewport)
  {
    return new Rectangle(Vector2f.add(rec.getOrigin(),viewport.getOrigin()), rec.getWidth(), rec.getHeight());
  }
View Full Code Here

    for(Thread t:threads)
    {
      try
      {
        Sprite s = (Sprite)t;
        Rectangle col = Math.worldToScreen(s.getCollisionRectangle(),game.getViewport());
        if(col.isInside(sc_coords))
        {
          this.selectedSprite = s;
          System.out.println(s.toString());
          return true;
        }
View Full Code Here

    this.VSYNC = V_Sync;
  }
 
  protected void init() throws LWJGLException, IllegalPlayerCountException, IOException
  {
    viewport = new Rectangle(0, HORIZONTAL_RESOLUTION, 0, VERTICAL_RESOLUTION);
   
    oglInit();
   
    map = OldMap.createTemplateMap(OldMap.TEMPLATE_ISLAND, 2);
   
View Full Code Here

TOP

Related Classes of general.datastructures.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.