Package testing

Source Code of testing.SquaresGen

package testing;

import org.newdawn.slick.geom.Vector2f;

import framework.collision.CircularCollisionMask;
import framework.collision.CollisionComponent;
import framework.component.ParentComponent;
import framework.rendering.SpriteComponent;
import framework.spacial.PositionComponent;

public class SquaresGen {

  public static ParentComponent generateGrid(int x, int y, int width, int height, float gridSpacing){
    ParentComponent p = new ParentComponent();
    PositionComponent pos = new PositionComponent(x,y);
    p.addComponent(pos);
    p.addComponent(new Grid(width, height, gridSpacing));
    return p;
  }
 
  public static ParentComponent generateDot(ParentComponent grandparent, int gridX, int gridY, float gridSpacing){
    ParentComponent p = new ParentComponent();
    grandparent.addComponent(p);
    PositionComponent pos = new PositionComponent(0,0);
    p.addComponent(pos);
    pos.setRelativeToParent(new Vector2f(gridSpacing*gridX,gridSpacing*gridY));
    p.addComponent(new Dot(gridX, gridY));
    p.addComponent(new SpriteComponent("res/img/dot.png",new Vector2f(-10, -10), 20, 20));
    p.addComponent(new CollisionComponent(new CircularCollisionMask(10)));
    return p;
  }
 
  public static ParentComponent generateLine(Dot from, Dot to){
    return null;
  }
}
TOP

Related Classes of testing.SquaresGen

TOP
Copyright © 2018 www.massapi.com. 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.