Package org.mt4j.input.inputProcessors

Examples of org.mt4j.input.inputProcessors.IGestureEventListener


    }
   
    //Register arcball gesture manipulation to the whole mesh-group
    meshGroup.setComposite(true); //-> Group gets picked instead of its children
    meshGroup.registerInputProcessor(new ArcballProcessor(mtApplication, biggestMesh));
    meshGroup.addGestureListener(ArcballProcessor.class, new IGestureEventListener(){
      //@Override
      public boolean processGestureEvent(MTGestureEvent ge) {
        ArcBallGestureEvent aEvt =  (ArcBallGestureEvent)ge;
        meshGroup.transform(aEvt.getTransformationMatrix());
        return false;
      }
    });
   
    meshGroup.registerInputProcessor(new ScaleProcessor(mtApplication));
    meshGroup.addGestureListener(ScaleProcessor.class, new IGestureEventListener(){
      //@Override
      public boolean processGestureEvent(MTGestureEvent ge) {
        ScaleEvent se = (ScaleEvent)ge;
        meshGroup.scaleGlobal(se.getScaleFactorX(), se.getScaleFactorY(), se.getScaleFactorX(), biggestMesh.getCenterPointGlobal());
        return false;


    group.addGestureListener(DragProcessor.class, new InertiaDragAction(80, 0.8f, 10));
    group.registerInputProcessor(new RotateProcessor(mtApplication));
    group.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    //Scale the earth from the center. Else it might get distorted
    group.registerInputProcessor(new ScaleProcessor(mtApplication));
    group.addGestureListener(ScaleProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        ScaleEvent se = (ScaleEvent)ge;
        earth.scaleGlobal(se.getScaleFactorX(), se.getScaleFactorY(), se.getScaleFactorX(), earth.getCenterPointGlobal());
        return false;
      }

   * @param cell the cell
   * @param createScene the create scene
   */
  private void addTapProcessor(MTListCell cell, final ICreateScene createScene){
    cell.registerInputProcessor(new TapProcessor(app, 15));
    cell.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        if (te.isTapped()){
          //System.out.println("Clicked cell: " + te.getTargetComponent());
          final Iscene scene = createScene.getNewScene();

      }
    });
   
    mapMenu.unregisterAllInputProcessors();
    mapMenu.registerInputProcessor(new TapProcessor(mtApplication, 50));
    mapMenu.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        if (((TapEvent)ge).getTapID() == TapEvent.BUTTON_CLICKED){
          if (!animationRunning){
            animationRunning = true;
            if (doSlideIn){

    listLabel.setText(label);
    cell.addChild(listLabel);
    listLabel.setPositionRelativeToParent(cell.getCenterPointLocal());
    cell.unregisterAllInputProcessors();
    cell.registerInputProcessor(new TapProcessor(p, 15));
    cell.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        switch (te.getTapID()) {
        case TapEvent.BUTTON_DOWN:
          cell.setFillColor(cellPressedFillColor);

                   
                    tagContainer.addChild(tagCircle);
                   
                    tagCircle.unregisterAllInputProcessors();
                    tagCircle.registerInputProcessor(new TapProcessor(p));
                    tagCircle.addGestureListener(TapProcessor.class, new IGestureEventListener(){
                      //@Override
                      public boolean processGestureEvent(MTGestureEvent g) {
                        if (g instanceof TapEvent) {
                          TapEvent ce = (TapEvent) g;
                          switch (ce.getTapID()) {

   
    //New Puzzle button
    MTRoundRectangle r = getRoundRectWithText(0, 0, 120, 35, "New Puzzle", font);
    r.registerInputProcessor(new TapProcessor(getMTApplication()));
    r.addGestureListener(TapProcessor.class, new DefaultButtonClickAction(r));
    r.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        if (te.isTapped()){
          if (list.isVisible()){
            list.setVisible(false);

    listLabel.setText(imageName);
    cell.addChild(listLabel);
    listLabel.setPositionRelativeToParent(cell.getCenterPointLocal());
    cell.unregisterAllInputProcessors();
    cell.registerInputProcessor(new TapProcessor(getMTApplication(), 15));
    cell.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        switch (te.getTapID()) {
        case TapEvent.BUTTON_DOWN:
          cell.setFillColor(cellPressedFillColor);

    //Add tap&hold gesture to clear all tails
    TapAndHoldProcessor tapAndHold = new TapAndHoldProcessor(mtApplication);
    tapAndHold.setMaxFingerUpDist(10);
    tapAndHold.setHoldTime(3000);
    tails.registerInputProcessor(tapAndHold);
    tails.addGestureListener(TapAndHoldProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapAndHoldEvent t = (TapAndHoldEvent)ge;
        if (t.getId() == TapAndHoldEvent.GESTURE_ENDED && t.isHoldComplete()){
          tails.clearTails()
        }

    windowBackGround.setPickable(false);
    this.addChild(windowBackGround);
   
    this.removeAllGestureEventListeners(ScaleProcessor.class);
//    cr.removeAllGestureEventListeners(RotationDetector.class);
    this.addGestureListener(ScaleProcessor.class, new IGestureEventListener(){
      //@Override
      public boolean processGestureEvent(MTGestureEvent ge) {
        ScaleEvent se = (ScaleEvent)ge;
       
        //Scale window background normally

TOP

Related Classes of org.mt4j.input.inputProcessors.IGestureEventListener

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.