Package org.newdawn.slick.geom

Examples of org.newdawn.slick.geom.Vector2f


        PositionChangedEvent p = (PositionChangedEvent) e;
        this.centreOfOrbit = p.getTo();
      }else if(e.getType().equals("TimePassed")){
        PositionComponent posComp = (PositionComponent) getSiblingByType(PositionComponent.class.getName());
        if(posComp != null){
          Vector2f pos = posComp.getVector();
          if(pos != null && centreOfOrbit != null && !pos.equals(centreOfOrbit)){
            TimePassedEvent t = (TimePassedEvent) e;
            posComp.setVector(VectorUtil.rotateAround(pos.copy(), centreOfOrbit, t.getDelta()*orbitalVelocity));
          }
        }
      }
    }
  } 
 
View Full Code Here


    this.from = in.readVector();
    this.to = in.readVector();
  }

  public Line(Vector2f from, float toX, float toY){
    this(from, new Vector2f(toX, toY));
  }
View Full Code Here

  public Line(Vector2f from, float toX, float toY){
    this(from, new Vector2f(toX, toY));
  }

  public Line(float fromX, float fromY, Vector2f to){
    this(new Vector2f(fromX, fromY), to);
  }
View Full Code Here

  public Line(float fromX, float fromY, Vector2f to){
    this(new Vector2f(fromX, fromY), to);
  }

  public Line(float fromX,float fromY, float toX,float toY){
    this(new Vector2f(fromX, fromY), new Vector2f(toX, toY));
  }
View Full Code Here

        det3And4, x3LessX4) /
        det1Less2And3Less4);
    float y = (det(det1And2, y1LessY2,
        det3And4, y3LessY4) /
        det1Less2And3Less4);
    return new Vector2f(x, y);
  }
View Full Code Here

    if (u > 1.0)
      return pt2.copy();
    else if (u <= 0.0)
      return pt1.copy();
    else
      return new Vector2f((int)(pt2.getX()*u+pt1.getX()*(1.0-u)+0.5), (int)(pt2.getY()*u+pt1.getY()*(1.0-u)+0.5));
  }
 
View Full Code Here

    if(otherMask != null && line != null && line.getFrom() != null && line.getTo() != null){
      if(otherMask instanceof PointCollisionMask){
        return getLine().translate(thisOrigin).isOnLine(otherOrigin.add(otherMask.getRelativePositionOfOrigin()));
      }else if(otherMask instanceof CircularCollisionMask){       
        CircularCollisionMask c = (CircularCollisionMask) otherMask;
        Vector2f centrePos = otherOrigin.add(c.getRelativePositionOfOrigin());
        float distanceToCentre = getLine().translate(thisOrigin).getShortestDistanceTo(centrePos);
        return distanceToCentre <= c.getRadius();
      }else if(otherMask instanceof LineCollisionMask){
        LineCollisionMask l = (LineCollisionMask) otherMask;
        return getLine().translate(thisOrigin).intersetsWith(l.getLine().translate(otherOrigin));
View Full Code Here

    List<RenderableComponent> renderableComponents = getAllRenderableComponents();
    Collections.sort(renderableComponents, RenderableComparator.getInstance());
    for(RenderableComponent renderableComp: renderableComponents){
      PositionComponent posComp = (PositionComponent) renderableComp.getSiblingByType(PositionComponent.class.getName());
      if(posComp != null){
        Vector2f pos = posComp.getVector();
        if(pos != null){

          int x = Math.round(pos.getX());
          int y = Math.round(pos.getY());

          if(renderableComp.getOffsetFromOrigin() != null){
            pos.add(renderableComp.getOffsetFromOrigin());
            x = Math.round(pos.getX());
            y = Math.round(pos.getY());
          }

          transformGraphicsFor(renderableComp, x, y, g);

          CameraComponent camera = (CameraComponent) ComponentSystem.getInstance().getComponent(cameraPath);
          if(camera != null){
            Vector2f cameraPos = camera.getTopLeftPosition();
            if(cameraPos != null){
              x -= cameraPos.x;
              y -= cameraPos.y;
            }
            if(camera.getWidth() != 0 && camera.getHeight() != 0){
View Full Code Here

  @Override
  public void draw(Graphics g, int x, int y) {
    g.setColor(Color.white);
    if(getMask() != null){
      getMask().renderForDebug(g, new Vector2f(x, y));
    }
  }
View Full Code Here

  public PointCollisionMask(Vector2f relativeOrigin){
    this.relativeOrigin = relativeOrigin;
  }
 
  public PointCollisionMask(){
    this(new Vector2f(0,0));
  }
View Full Code Here

TOP

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

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.