Package framework.spacial

Examples of framework.spacial.PositionComponent


    CollisionComponent collis = new CollisionComponent(new CircularCollisionMask(10));
    cursorParent.addComponent(collis);

    setUpEventListener(collis);

    cursorParent.addComponent(new PositionComponent(50,50));
    cursorParent.addComponent(new MouseFollowerComponent());
    return cursorParent;
  }
View Full Code Here


   */
  private static void createDot(float x, float y, ParentComponent gridParent){
    ParentComponent ballParent = new ParentComponent();
    gridParent.addComponent(ballParent);

    PositionComponent ballPos = new PositionComponent(x,y);
    ballParent.addComponent(ballPos);
    SpriteComponent ballSprite = new SpriteComponent(ColourManager.getDot(), 17, 17);
    ballParent.addComponent(ballSprite);
  }
View Full Code Here

 
  public static void generateBackground(){
    ParentComponent backgroundParent = new ParentComponent("Background");
    ComponentSystem.getInstance().getRoot().addComponent(backgroundParent);
   
    backgroundParent.addComponent(new PositionComponent(0,0));
   
    SpriteComponent spriteComp = new SpriteComponent(BACKGROUND_FILENAME);
    spriteComp.setAlwaysOnBottom();
    backgroundParent.addComponent(spriteComp);
  }
View Full Code Here

    if(e != null){
      if(e.getType().equals("PositionChanged")){
        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

      }
    }
  }
 
  public void updateCamera(){
    PositionComponent p = (PositionComponent) getSiblingByType(PositionComponent.class.getName());
    if(p != null){
      this.updateCamera(p.getVector());
    }
  }
View Full Code Here

    width = gc.getWidth();
    height = gc.getHeight();
    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());
View Full Code Here

  }

  @Override
  public void onEvent(Event e) {
    if(e != null && e.getType().equals("MouseMoved")){
      PositionComponent pos = (PositionComponent) getSiblingByType(PositionComponent.class.getName());
      if(pos != null){
        MouseMovedEvent m = (MouseMovedEvent) e;
        pos.setVector(m.getTo());
      }
    }
  }
View Full Code Here

   
    if(isHorizontal){
      lineParent.addComponent(new OrientationComponent(270));
    }
   
    PositionComponent pos;

    //TODO remove this weird pixel adjustment to make it cleaner, and independant of image size.
    if(isHorizontal){
      pos = new PositionComponent(screenX + 12, screenY+ 10);
    }else{
      pos = new PositionComponent(screenX + 5, screenY + 15);
    }

    lineParent.addComponent(pos);

    return lineParent;
View Full Code Here

    float x = gridX*spacing+10;
    float y = gridY*spacing+10;

    //TODO remove these weird coordinate adjustions.
    squareParent.addComponent(new PositionComponent(x,y));
    squareParent.addComponent(new SquareComponent(grid.getSquare(gridX, gridY)));

    return squareParent;
  }
View Full Code Here

   
    SpriteComponent spriteComp = new SpriteComponent(ColourManager.getSquareForPlayer(player.getId()), new Vector2f(-20, -12), 50, 50);
    counterParent.addComponent(spriteComp);
   
    counterParent.addComponent(new TextRenderComponent(""));
    counterParent.addComponent(new PositionComponent(690+(60*player.getId()), 25));
   
    ComponentSystem.getInstance().getParentComponentByLabel("Background").addComponent(counterParent);
  }
View Full Code Here

TOP

Related Classes of framework.spacial.PositionComponent

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.