Package framework.event

Examples of framework.event.EventListener


  }

  private static void setUpEventListener(Component collis) {
    ComponentPath path = new AbsoluteComponentPath(collis);
    EventSenderComponentFilter filter = new EventSenderComponentFilter(new ComponentPathFilter(path));
    EventListener listener = generateCollisionListener();

    EventSystem.getInstance().registerEventListener(listener, "CollisionStarted", filter);
    EventSystem.getInstance().registerEventListener(listener, "CollisionStopped", filter);
    EventSystem.getInstance().registerEventListener(listener, "MouseReleased", null);
  }
View Full Code Here


    EventSystem.getInstance().registerEventListener(listener, "CollisionStopped", filter);
    EventSystem.getInstance().registerEventListener(listener, "MouseReleased", null);
  }

  private static EventListener generateCollisionListener() {
    return new EventListener() {
      @Override
      public void onEvent(Event e) {
        if(e != null){
          if(e.getType().equals("CollisionStarted")){
            onCollisionStarted((CollisionEvent)e);
View Full Code Here

    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);
      }
     
View Full Code Here

TOP

Related Classes of framework.event.EventListener

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.