Package framework.rendering

Examples of framework.rendering.SpriteComponent


    deselectLine(e.getCollidedWith());
  }
 
  private static void deselectLine(CollisionComponent c){
    if(c != null && !isSiblingLinePlaced(c)){
      SpriteComponent spriteComp = (SpriteComponent) c.getSiblingByType(SpriteComponent.class.getName());
      if(spriteComp != null){
        spriteComp.setImageFilename(ColourManager.getUnplacedLine(), true);
      }
    }
  }
View Full Code Here


    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

    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

  @Override
  public void onEvent(Event e) {
    if(e != null && e.getType().equals("SquarePlaced")){
      SquarePlacedEvent lineEvent = (SquarePlacedEvent) e;
      if(lineEvent.getSquare() != null && lineEvent.getSquare().equals(this.square)){
        SpriteComponent squareSprite = (SpriteComponent) ComponentSystem.getInstance().getComponentWithTypeAndLabel(SquareGenerator.getSquareLabel(square), SpriteComponent.class);
        if(squareSprite != null){
          squareSprite.setImageFilename(ColourManager.getSquareForPlayer(square.getOwningPlayer().getId()), true);
        }
      }
    }
  }
View Full Code Here

    int lineWidth = 50;

    lineParent.addComponent(new CollisionComponent(new LineCollisionMask(new Line(0, 0, 0,lineWidth))));

    lineParent.addComponent(new SpriteComponent(ColourManager.getUnplacedLine()));
   
    if(isHorizontal){
      lineParent.addComponent(new OrientationComponent(270));
    }
   
View Full Code Here

  }

  private static ParentComponent generateSquare(Grid grid, int gridX, int gridY, int spacing){
    ParentComponent squareParent = new ParentComponent(getSquareLabel(gridX, gridY));

    squareParent.addComponent(new SpriteComponent("res/img/Blank.png", spacing - 5, spacing - 5));

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

    //TODO remove these weird coordinate adjustions.
View Full Code Here

  @Override
  public void onEvent(Event e) {
    if(e != null && e.getType().equals("LinePlaced")){
      LinePlacedEvent lineEvent = (LinePlacedEvent) e;
      if(lineEvent.getLine() != null && lineEvent.getLine().equals(this.l)){
        SpriteComponent lineSprite = (SpriteComponent) ComponentSystem.getInstance().getComponentWithTypeAndLabel(GridLineGenerator.getLineLabel(l), SpriteComponent.class);
        if(lineSprite != null){
          lineSprite.setImageFilename(ColourManager.getLineForPlayer(lineEvent.getPlayerID()), true);
        }
      }
    }
  }
View Full Code Here

  private static void setUpScoreCounter(Player player) {
    ParentComponent counterParent = new ParentComponent();
    counterParent.addComponent(new ScoreCounterComponent(player));
   
    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));
   
View Full Code Here

//      textComp.setText("Player "+currentPlayer.getName()+"'s move");
//
//      changeCursorColour();
//    }
   
    SpriteComponent spriteComp = (SpriteComponent) getSiblingByType(SpriteComponent.class.getName());
    if(spriteComp != null && currentPlayer != null){
      spriteComp.setImageFilename(ColourManager.getSquareForPlayer(currentPlayer.getId()), true);
      changeCursorColour();
    }
  }
View Full Code Here

      changeCursorColour();
    }
  }

  private void changeCursorColour() {
    SpriteComponent cursorSprite = (SpriteComponent) ComponentSystem.getInstance().getComponentWithTypeAndLabel("Cursor", SpriteComponent.class);
    if(cursorSprite != null){
      cursorSprite.setImageFilename(ColourManager.getCursorForPlayer(currentPlayer.getId()), true);
    }
  }
View Full Code Here

TOP

Related Classes of framework.rendering.SpriteComponent

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.