Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Shape


   */

  Rectangle tmprect = new Rectangle(0, 0, 0, 0);

  public boolean isInView(Actor a) {
    Shape ab = a.getShape();
    tmprect.setBounds(ab.getX(), ab.getY(), ab.getMaxX(), ab.getMaxY());
    boolean v = tmprect.intersects(vrect);
    return v;
  }
View Full Code Here


   */
  public void paint(Graphics g) {
    if (mapwidth > 0 && mapheight > 0) {
      for (int j = 0; j < mapheight; j++) {
        for (int i = 0; i < mapwidth; i++) {
          Shape r = getTileShape(i, j);
          if (isInView(r)) {
            renderCell(g, i, j, r);
          }
        }
      }
View Full Code Here

   */
  public boolean checkCollide(){
    if(a==null||b==null)return false
    if(b.isDead()||!b.isVisible()) return false;
   
    Shape s2=b.getShape();
    float p[]=s2.getPoints();
    for(int i=0;i<p.length/2;i++){
      if(a.contains(p[i*2],p[i*2+1])){
        x=(int)(p[i*2]-a.getX());    // �ԡѴ�������ѹ��Ѻ  a.x
        y=(int)(p[i*2+1]-a.getY())// �ԡѴ�������ѹ��Ѻ  a.y
        return true;
View Full Code Here

   */
  private ArrayList combineImpl(ArrayList shapes) {
    ArrayList result = new ArrayList(shapes);

    for (int i = 0; i < shapes.size(); i++) {
      Shape first = (Shape) shapes.get(i);
      for (int j = i + 1; j < shapes.size(); j++) {
        Shape second = (Shape) shapes.get(j);

        Shape[] joined = util.union(first, second);
        if (joined.length == 1) {
          result.remove(first);
          result.remove(second);
View Full Code Here

   */
  public void render(GameContainer container, Graphics g)
      throws SlickException {
    g.setColor(Color.green);
    for (int i = 0; i < original.size(); i++) {
      Shape shape = (Shape) original.get(i);
      g.draw(shape);
    }

    g.translate(0, 320);
    g.setColor(Color.white);

    for (int i = 0; i < combined.size(); i++) {
      g.setColor(Color.white);
      Shape shape = (Shape) combined.get(i);
      g.draw(shape);
      for (int j = 0; j < shape.getPointCount(); j++) {
        g.setColor(Color.yellow);
        float[] pt = shape.getPoint(j);
        g.fillOval(pt[0] - 1, pt[1] - 1, 3, 3);
      }
    }

  }
View Full Code Here

  public float getScaley() {
    return scaley;
  }

  public Shape getShape() {
    Shape b = bound;
    float sx = getX();
    float sy = getY();
    if (scalex != 1 || scaley != 1) {
      b = new Rectangle(sx, sy, bound.getWidth() * scalex, bound
          .getHeight()
          * scaley);
    }
    if (rotation > 0.1f || rotation < -0.1f) {
      if (cacheRotation == rotation && cacheShape != null && sx == cacheX
          && sy == cacheY) {
        return cacheShape;
      }
      float angle = (float) Math.toRadians(rotation);
      Shape s = b.transform(Transform.createRotateTransform(angle,
          getCenterX(), getCenterY()));
      cacheShape = s;
      cacheRotation = rotation;
      cacheX = getX();
      cacheY = getY();
View Full Code Here

    Polygon poly = new Polygon();
    int count = processPoly(poly, element, tokens);
   
    NonGeometricData data = Util.getNonGeometricData(element);
    if (count > 3) {
      Shape shape = poly.transform(transform);
     
      diagram.addFigure(new Figure(Figure.POLYGON, shape, data, transform));
    }
  }
View Full Code Here

    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,height);
    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

      if (diagram.getPatternDef(fill) != null){
        System.out.println("PATTERN");
      }
      if (diagram.getGradient(fill) != null) {
        Gradient gradient = diagram.getGradient(fill);
        Shape shape = diagram.getFigure(i).getShape();
        TexCoordGenerator fg = null;
        if (gradient.isRadial()) {
          fg = new RadialGradientFill(shape, diagram.getFigure(i).getTransform(), gradient)
        } else {
          fg = new LinearGradientFill(shape, diagram.getFigure(i).getTransform(), gradient);
View Full Code Here

    Polygon poly = new Polygon();
    int count = processPoly(poly, element, tokens);
   
    NonGeometricData data = Util.getNonGeometricData(element);
    if (count > 3) {
      Shape shape = poly.transform(transform);
     
      diagram.addFigure(new Figure(Figure.POLYGON, shape, data, transform));
    }
  }
View Full Code Here

TOP

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

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.