Package framework.spacial

Examples of framework.spacial.OrientationComponent


  @Override
  public void onEvent(Event e) {
    if(e != null){
      if(e.getType().equals("TimePassed")){
        OrientationComponent orientaion = (OrientationComponent) getSiblingByType(OrientationComponent.class.getName());
        if(orientaion != null){
          TimePassedEvent t = (TimePassedEvent) e;
          orientaion.setValue(orientaion.getValue()+t.getDelta()*this.getValue());
        }
      }
    }
  }
 
View Full Code Here


    }
  }

  public void transformGraphicsFor(RenderableComponent renderableComp, int x, int y, Graphics g){

    OrientationComponent orientationComp = (OrientationComponent) renderableComp.getSiblingByType(OrientationComponent.class.getName());
    if(orientationComp != null){
      float theta = orientationComp.getValue();
      if(theta != 0){
        g.rotate(x, y, theta);
      }
    }
  }
View Full Code Here

    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));
    }
   
    PositionComponent pos;

    //TODO remove this weird pixel adjustment to make it cleaner, and independant of image size.
View Full Code Here

    s1.setAlwaysOnTop();
    p1.addComponent(s1);
   
    p1.addComponent(new MouseFollowerComponent());
    p1.addComponent(new CollisionComponent(new CircularCollisionMask(25)));
    p1.addComponent(new OrientationComponent(-100));
    final SpinComponent spin = new SpinComponent(0.1f);
    //p1.addComponent(spin);
    EventSystem.getInstance().registerEventListener(new EventListener() {
      private int button;
      @Override
      public void onEvent(Event e) {
        int b = ((MousePressedEvent) e).getButton();
        if(b != button){
          spin.setValue(-spin.getValue());
          button = b;
        }
        p1.addComponent(spin);
      }
     
      @Override
      public int getUniqueID() {
        return 0;
      }
     
      @Override
      public String getType() {
        return "Custom";
      }
    }, "MousePressed", null);
   
    EventSystem.getInstance().registerEventListener(new EventListener() {
      @Override
      public void onEvent(Event e) {
        p1.removeComponent(spin);
      }
     
      @Override
      public int getUniqueID() {
        return 1;
      }
     
      @Override
      public String getType() {
        return "Custom";
      }
    }, "MouseReleased", null);
   
    ParentComponent gridParent = SquaresGen.generateGrid(90, 50, 10, 10, 50);
    root.addComponent(gridParent);
    gridParent.addComponent(new OrbitalVelocityComponent(0.5f, new Vector2f(95, 55)));
   
   
   
    ParentComponent p2 = new ParentComponent();
   
    p1.addComponent(p2);
   
    p2.addComponent(new PositionComponent(10, 150));
    p2.addComponent(new SpriteComponent("res/img/square.png"));
    p2.addComponent(new OrientationComponent(100));
    p2.addComponent(new TextRenderComponent("Click to rotate!"));
   
    ParentComponent p3 = new ParentComponent();
    p3.addComponent(new PositionComponent (700,100));
    p3.addComponent(new SpriteComponent("res/img/line.png",new Vector2f(0, 0), 50, 50));
    p3.addComponent(new OrientationComponent(100));
   
   
    root.addComponent(p1);
    root.addComponent(p3);
    root.addComponent(new ColourChangeComponent());
View Full Code Here

    ParentComponent gridLine = new ParentComponent();
    root.addComponent(gridLine);
    gridLine.addComponent(new GridLine());
    gridLine.addComponent(new SpriteComponent("res/img/square.png", 10, 50));
    gridLine.addComponent(new PositionComponent(500,500));
    gridLine.addComponent(new OrientationComponent(100));
    gridLine.addComponent(new CollisionComponent(new LineCollisionMask(new Line(0, 0, 0, 100))));
    //gridLine.addComponent(new CollisionComponent(new RectangularCollisionMask(new Rectangle(10, 50))));
   
    ParentComponent cursor = new ParentComponent();
    root.addComponent(cursor);
View Full Code Here

TOP

Related Classes of framework.spacial.OrientationComponent

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.