Package org.mt4j.input.inputProcessors.componentProcessors.dragProcessor

Examples of org.mt4j.input.inputProcessors.componentProcessors.dragProcessor.DragProcessor


       
        //Put planets in a group that can be manipulated by gestures
        //so the rotation of the planets doesent get changed by the gestures
    MTComponent group = new MTComponent(mtApplication);
    group.setComposite(true); //This makes the group "consume" all picking and gestures of the children
    group.registerInputProcessor(new DragProcessor(mtApplication));
    group.addGestureListener(DragProcessor.class, new DefaultDragAction());
    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
View Full Code Here


    map = new TestInteractiveMap(mtApplication, mapProvider);
    map.setName("map");
    map.MAX_IMAGES_TO_KEEP = 256;
    map.sc = 4//Initial map scale
    //Map gestures
    map.registerInputProcessor(new DragProcessor(mtApplication));
    map.addGestureListener(DragProcessor.class, new MapDrag());
   
    map.registerInputProcessor(new ScaleProcessor(mtApplication));
    map.addGestureListener(ScaleProcessor.class, new MapScale());
   
View Full Code Here

   
  }
 
  @Override
  protected void setDefaultGestureActions() {
    this.registerInputProcessor(new DragProcessor(getRenderer()));
//    this.addGestureListener(DragProcessor.class, new DefaultDragAction());
  }
View Full Code Here

   
    this.listCellContainer = new MTListCellContainer(x,y,1,1, applet);
    this.addChild(listCellContainer);
   
    //So we can drag the cell container when dragging on the list
    this.registerInputProcessor(new DragProcessor(applet));
    this.removeAllGestureEventListeners(DragProcessor.class);
    this.addGestureListener(DragProcessor.class, new ListCellDragListener(listCellContainer));
   
  }
View Full Code Here

      this.cells.add(index, item);
      this.updateLayout();
     
      //Add drag listener which drags the cells parent (listcontainer) restriced to one axis
      if (!hasDragProcessor(item)){
        item.registerInputProcessor(new DragProcessor(app));
      }
     
      //Remove the default drag listener from the cell for safety
      IGestureEventListener[] l = item.getGestureListeners();
        for (int j = 0; j < l.length; j++) {
View Full Code Here

    MTTextArea dragOnly = new MTTextArea(mtApplication, font);
    dragOnly.setFillColor(textAreaColor);
    dragOnly.setStrokeColor(textAreaColor);
    dragOnly.setText("Drag me!");
    this.clearAllGestures(dragOnly);
    dragOnly.registerInputProcessor(new DragProcessor(app));
    dragOnly.addGestureListener(DragProcessor.class, new DefaultDragAction());
    dragOnly.addGestureListener(DragProcessor.class, new InertiaDragAction()); //Add inertia to dragging
    this.getCanvas().addChild(dragOnly);
   
    MTTextArea rotateOnly = new MTTextArea(mtApplication, font);
    rotateOnly.setFillColor(textAreaColor);
    rotateOnly.setStrokeColor(textAreaColor);
    rotateOnly.setText("Rotate me!");
    this.clearAllGestures(rotateOnly);
    rotateOnly.registerInputProcessor(new RotateProcessor(app));
    rotateOnly.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    this.getCanvas().addChild(rotateOnly);
    rotateOnly.setAnchor(PositionAnchor.UPPER_LEFT);
    rotateOnly.setPositionGlobal(new Vector3D(0, verticalPad,0));
   
    MTTextArea scaleOnly = new MTTextArea(mtApplication, font);
    scaleOnly.setFillColor(textAreaColor);
    scaleOnly.setStrokeColor(textAreaColor);
    scaleOnly.setText("Scale me!");
    this.clearAllGestures(scaleOnly);
    scaleOnly.registerInputProcessor(new ScaleProcessor(app));
    scaleOnly.addGestureListener(ScaleProcessor.class, new DefaultScaleAction());
    this.getCanvas().addChild(scaleOnly);
    scaleOnly.setAnchor(PositionAnchor.UPPER_LEFT);
    scaleOnly.setPositionGlobal(new Vector3D(0, 2*verticalPad,0));
   
    MTTextArea dragAndRotate = new MTTextArea(mtApplication, font);
    dragAndRotate.setFillColor(textAreaColor);
    dragAndRotate.setStrokeColor(textAreaColor);
    dragAndRotate.setText("Drag and Rotate me!");
    this.clearAllGestures(dragAndRotate);
    dragAndRotate.registerInputProcessor(new RotateProcessor(app));
    dragAndRotate.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    dragAndRotate.registerInputProcessor(new DragProcessor(app));
    dragAndRotate.addGestureListener(DragProcessor.class, new DefaultDragAction());
    this.getCanvas().addChild(dragAndRotate);
    dragAndRotate.setAnchor(PositionAnchor.UPPER_LEFT);
    dragAndRotate.setPositionGlobal(new Vector3D(0, 3*verticalPad,0));
   
    MTTextArea dragAndScale = new MTTextArea(mtApplication, font);
    dragAndScale.setFillColor(textAreaColor);
    dragAndScale.setStrokeColor(textAreaColor);
    dragAndScale.setText("Drag and Scale me!");
    this.clearAllGestures(dragAndScale);
    dragAndScale.registerInputProcessor(new ScaleProcessor(app));
    dragAndScale.addGestureListener(ScaleProcessor.class, new DefaultScaleAction());
    dragAndScale.registerInputProcessor(new DragProcessor(app));
    dragAndScale.addGestureListener(DragProcessor.class, new DefaultDragAction());
    this.getCanvas().addChild(dragAndScale);
    dragAndScale.setAnchor(PositionAnchor.UPPER_LEFT);
    dragAndScale.setPositionGlobal(new Vector3D(0, 8*verticalPad,0));
   
    MTTextArea rotateAndScale = new MTTextArea(mtApplication, font);
    rotateAndScale.setFillColor(textAreaColor);
    rotateAndScale.setStrokeColor(textAreaColor);
    rotateAndScale.setText("Rotate and Scale me!");
    this.clearAllGestures(rotateAndScale);
    rotateAndScale.registerInputProcessor(new ScaleProcessor(app));
    rotateAndScale.addGestureListener(ScaleProcessor.class, new DefaultScaleAction());
    rotateAndScale.registerInputProcessor(new RotateProcessor(app));
    rotateAndScale.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    this.getCanvas().addChild(rotateAndScale);
    rotateAndScale.setAnchor(PositionAnchor.UPPER_LEFT);
    rotateAndScale.setPositionGlobal(new Vector3D(0,9*verticalPad,0));
   
    MTTextArea dragRotScale = new MTTextArea(mtApplication, font);
    dragRotScale.setFillColor(textAreaColor);
    dragRotScale.setStrokeColor(textAreaColor);
    dragRotScale.setText("Drag, Rotate and Scale me!");
    this.clearAllGestures(dragRotScale);
    dragRotScale.registerInputProcessor(new ScaleProcessor(app));
    dragRotScale.addGestureListener(ScaleProcessor.class, new DefaultScaleAction());
    dragRotScale.registerInputProcessor(new RotateProcessor(app));
    dragRotScale.addGestureListener(RotateProcessor.class, new DefaultRotateAction());
    dragRotScale.registerInputProcessor(new DragProcessor(app));
    dragRotScale.addGestureListener(DragProcessor.class, new DefaultDragAction());
    this.getCanvas().addChild(dragRotScale);
    dragRotScale.setAnchor(PositionAnchor.UPPER_LEFT);
    dragRotScale.setPositionGlobal(new Vector3D(0,10*verticalPad,0));
   
 
View Full Code Here

         
          //Add gestures //TODO what about the isRotatable/dragable settings of the childs?
          //TODO What if we want to click a item of the cluster only? ->Maybe cluster should
          //delegate other gestures to the components..
//          cluster.assignGestureClassAndAction(DragGestureAnalyzer.class,    new DefaultDragAction());
          cluster.registerInputProcessor(new DragProcessor(pa));
          cluster.addGestureListener(DragProcessor.class, new DefaultDragAction());
         
          cluster.addGestureListener(DragProcessor.class, new InertiaDragAction());
         
          cluster.registerInputProcessor(new RotateProcessor(pa));
View Full Code Here

        }

        //Make the group pickable and manipulatable
        group.setPickable(true);
       
        group.registerInputProcessor(new DragProcessor(pa));
        group.setGestureAllowance(DragProcessor.class, true);
        group.addGestureListener(DragProcessor.class, (IGestureEventListener)defaultDragAction);
       
        group.registerInputProcessor(new RotateProcessor(pa));
        group.addGestureListener(RotateProcessor.class, defaultRotateAction);
View Full Code Here

        if (abstractComponentProcessor instanceof DragProcessor) {
          hasDragProcessor = true;
        }
      }
      if (!hasDragProcessor){
        comp.registerInputProcessor(new DragProcessor(comp.getRenderer()));
      }
     
      //For static bodies just alter the transform of the body
      comp.addGestureListener(DragProcessor.class, new IGestureEventListener() {
        //@Override
View Full Code Here

    leftSide.setName("left side");
    leftSide.setNoFill(true); //Make it invisible -> only used for dragging
    leftSide.setNoStroke(true);
    leftSide.unregisterAllInputProcessors();
    leftSide.removeAllGestureEventListeners(DragProcessor.class);
    leftSide.registerInputProcessor(new DragProcessor(app));
    leftSide.addGestureListener(DragProcessor.class, new GameFieldHalfDragListener(blueCircle));
    physicsContainer.addChild(0, leftSide);
    MTRectangle rightSide = new MTRectangle(
        PhysicsHelper.scaleDown(app.width/2f, scale), PhysicsHelper.scaleDown(0, scale),
        PhysicsHelper.scaleDown(app.width, scale), PhysicsHelper.scaleDown(app.height, scale)
        , app);
    rightSide.setName("right Side");
    rightSide.setNoFill(true); //Make it invisible -> only used for dragging
    rightSide.setNoStroke(true);
    rightSide.unregisterAllInputProcessors();
    rightSide.removeAllGestureEventListeners(DragProcessor.class);
    rightSide.registerInputProcessor(new DragProcessor(app));
    rightSide.addGestureListener(DragProcessor.class, new GameFieldHalfDragListener(redCircle));
    physicsContainer.addChild(0, rightSide);
   
    //Display Score UI
    MTComponent uiLayer = new MTComponent(mtApplication, new MTCamera(mtApplication));
View Full Code Here

TOP

Related Classes of org.mt4j.input.inputProcessors.componentProcessors.dragProcessor.DragProcessor

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.