Package org.mt4j.input.inputProcessors.componentProcessors.tapProcessor

Examples of org.mt4j.input.inputProcessors.componentProcessors.tapProcessor.TapProcessor


   *
   * @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());
View Full Code Here


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

    listLabel.setNoStroke(true);
    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:
View Full Code Here

                    tagToPhoto.put(tagCircle, foto);
                   
                    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;
View Full Code Here

   
    IFont font = FontManager.getInstance().createFont(mtApplication, "SansSerif", 16, MTColor.WHITE, MTColor.WHITE, false);
   
    //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()){
View Full Code Here

    listLabel.setNoStroke(true);
    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:
View Full Code Here

   
//    outerShape = new MTRectangle(x,y, width, height, applet);
    outerShape = new MTRoundRectangle(x,y,0, width, height, knobWidth/2f + innerPadding, knobHeight/2f  + innerPadding, applet);
    outerShape.unregisterAllInputProcessors();
    //When we click on the outershape move the knob in that direction a certain step
    outerShape.registerInputProcessor(new TapProcessor(applet, 35));
    outerShape.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        switch (te.getTapID()) {
        case TapEvent.BUTTON_CLICKED:
View Full Code Here

    final MTTextArea tapOnly = new MTTextArea(mtApplication, font);
    tapOnly.setFillColor(textAreaColor);
    tapOnly.setStrokeColor(textAreaColor);
    tapOnly.setText("Tap me! ---");
    this.clearAllGestures(tapOnly);
    tapOnly.registerInputProcessor(new TapProcessor(app));
    tapOnly.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        switch (te.getId()) {
        case MTGestureEvent.GESTURE_DETECTED:
          tapOnly.setFillColor(new MTColor(220,220,220,255));
          break;
        case MTGestureEvent.GESTURE_UPDATED:
          break;
        case MTGestureEvent.GESTURE_ENDED:
          if (te.isTapped()){
            if (tapOnly.getText().endsWith("--"))
              tapOnly.setText("Tap me! -|-");
            else
              tapOnly.setText("Tap me! ---")
          }
          tapOnly.setFillColor(textAreaColor);
          break;
        }
        return false;
      }
    });
    this.getCanvas().addChild(tapOnly);
    tapOnly.setAnchor(PositionAnchor.UPPER_LEFT);
    tapOnly.setPositionGlobal(new Vector3D(1*horizontalPad,0,0));
   
    //Double Tap gesture
    final MTTextArea doubleTap = new MTTextArea(mtApplication, font);
    doubleTap.setFillColor(textAreaColor);
    doubleTap.setStrokeColor(textAreaColor);
    doubleTap.setText("Double Tap me! ---");
    this.clearAllGestures(doubleTap);
    doubleTap.registerInputProcessor(new TapProcessor(app, 25, true, 350));
    doubleTap.addGestureListener(TapProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        TapEvent te = (TapEvent)ge;
        if (te.isDoubleTap()){
          if (doubleTap.getText().endsWith("--"))
View Full Code Here

//    space.translate(new Vector3D(100, space.getOriginalHeight(), 0)); //Translate to 0,0
//    space.translate(new Vector3D(225, 190,0));
    scaleKey(space, 40);
    space.setPositionRelativeToParent(new Vector3D(350,210,0));
    space.setGestureAllowance(TapProcessor.class, true);
    space.registerInputProcessor(new TapProcessor(pa));
    space.addGestureListener(TapProcessor.class, keyClickAction);
    SpaceF = null;
    keyList.add(space);
    this.addChild(space);

    KeyInfo[] keyInfos = this.getKeysLayout();
   
    //CREATE THE KEYS \\
//    for (int i = 0; i < keyInfos.size(); i++) {
//      KeyInfo keyInfo = keyInfos.get(i);
    for (int i = 0; i < keyInfos.length; i++) {
      KeyInfo keyInfo = keyInfos[i];
     
      VectorFontCharacter fontChar = (VectorFontCharacter) keyFont.getFontCharacterByUnicode(keyInfo.keyfontUnicode);
      //FIXME expensive..
//      MTKey key = new MTKey(fontChar.getGeometryInfo().getVertices(), fontChar.getContours(),pa, keyInfo.charUnicodeToWrite, keyInfo.charUnicodeToWriteShifted);
//      MTKey key = new MTKey(new Vertex[]{new Vertex(0,0,0),new Vertex(10,0,0),new Vertex(0,10,0),}, /*fontChar.getContours(),*/ pa, keyInfo.charUnicodeToWrite, keyInfo.charUnicodeToWriteShifted);
      MTKey key = new MTKey(fontChar.getGeometryInfo(),  pa, keyInfo.charUnicodeToWrite, keyInfo.charUnicodeToWriteShifted);
//      key.setGeometryInfo(fontChar.getGeometryInfo());
      key.setName(fontChar.getName());
      key.setPickable(true);
      key.unregisterAllInputProcessors();
     
      key.setOutlineContours(fontChar.getContours());
      if (MT4jSettings.getInstance().isOpenGlMode()){
        key.setUseDirectGL(true);
        //Use the display lists already created for the font characters of the key-font
        key.getGeometryInfo().setDisplayListIDs(fontChar.getGeometryInfo().getDisplayListIDs());
        key.setUseDisplayList(true);
      }
//      key.setOutlineContours(fontChar.getContours());
     
      //Translate to 0,0
//      key.translate(new Vector3D(0,key.getOriginalHeight(),0));
      //Translate to its designated position
//      key.translate(keyInfo.position);
     
      scaleKey(key, 40);
     
      //Scale ENTER and BACKSPACE
      if (key.getCharacterToWrite().equals("\n")){
//        key.scale(1.60f, 1.60f, 1, key.getCenterPointLocal());
//        key.scale(1.70f, 1.70f, 1, new Vector3D(0,0,0), TransformSpace.LOCAL);
        key.scale(1.70f, 1.70f, 1, key.getCenterPointLocal(), TransformSpace.LOCAL);
      }
     
      key.setPositionRelativeToParent(keyInfo.position);
     
      //this is a hack to fit the bounding shape of the "enter" key to its non-rectangular shape
      if (key.getCharacterToWrite().equals("\n")){
        Vector3D[] v = key.getBounds().getVectorsLocal();
        float indent = (v[1].getX()-v[0].getX())/2f;
        Vertex[] vNew = new Vertex[]{
             new Vertex(v[0].getX(),v[0].getY()+indent,0)
            ,new Vertex(v[0].getX()+indent  -indent/8f ,v[0].getY()+indent,0) //
            ,new Vertex(v[0].getX()+indent  -indent/8f,v[0].getY(),0) //
            ,new Vertex(v[1])
            ,new Vertex(v[2])
            ,new Vertex(v[3])
            ,new Vertex(v[0].getX(),v[0].getY()+indent,0)
        };
        BoundsArbitraryPlanarPolygon newBounds = new BoundsArbitraryPlanarPolygon(key, vNew); //Expensive..
        key.setBoundsBehaviour(AbstractShape.BOUNDS_ONLY_CHECK);
        key.setBounds(newBounds);
      }
     
      keyList.add(key);
      key.setGestureAllowance(TapProcessor.class, true);
      key.registerInputProcessor(new TapProcessor(pa));
      key.addGestureListener(TapProcessor.class, keyClickAction);
     
      //Add keys that change during SHIFT to a list
      if (keyInfo.visibilityInfo       == KeyInfo.KEY_ONLY_VISIBLE_WHEN_SHIFT_NOTPRESSED){
        shiftChangers.add(key);
View Full Code Here

    registeredActionListeners = new ArrayList<ActionListener>();
   
    this.setSvgOptions(this, AbstractShape.BOUNDS_CHECK_THEN_GEOMETRY_CHECK );
   
    this.setGestureAllowance(TapProcessor.class, true);
    this.registerInputProcessor(new TapProcessor(pa));
    this.addGestureListener(TapProcessor.class, new DefaultSvgButtonClickAction(this));
   
    //Draw this component and its children above
    //everything previously drawn and avoid z-fighting
    this.setDepthBufferDisabled(true);
View Full Code Here

TOP

Related Classes of org.mt4j.input.inputProcessors.componentProcessors.tapProcessor.TapProcessor

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.