Examples of MTRoundRectangle


Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

   
    tagToPhoto = new HashMap<MTEllipse, Photo>();
   
    /// Create map provider menu \\\
    IFont font = FontManager.getInstance().createFont(p, "SansSerif.Bold", 15, MTColor.WHITE, MTColor.WHITE);
    MTRoundRectangle mapMenu = new MTRoundRectangle(0,0,0, 220,335, 20,20, p);
//    mapMenu.setFillColor(new MTColor(110,110,110,180));
//    mapMenu.setStrokeColor(new MTColor(110,110,110,180));
    mapMenu.setFillColor(new MTColor(35,35,35,180));
    mapMenu.setStrokeColor(new MTColor(35,35,35,180));
    mapMenu.setPositionGlobal(new Vector3D(p.width/2f, p.height/2f));
    mapMenu.translateGlobal(new Vector3D(-p.width/2f - 80,0));
    getCanvas().addChild(mapMenu);
   
    float cellWidth = 155;
    float cellHeight = 40;
    MTColor cellFillColor = new MTColor(new MTColor(0,0,0,210));
    MTColor cellPressedFillColor = new MTColor(new MTColor(20,20,20,220));
   
    MTList list = new MTList(0,0, 152, 7* cellHeight + 7*3, p);
    list.setChildClip(null); //FIXME TEST -> do no clipping for performance
    list.setNoFill(true);
    list.setNoStroke(true);
    list.unregisterAllInputProcessors();
    list.setAnchor(PositionAnchor.CENTER);
    list.setPositionRelativeToParent(mapMenu.getCenterPointLocal());
    mapMenu.addChild(list);
   
    list.addListElement(this.createListCell("Microsoft Aerial", font, new Microsoft.AerialProvider(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Microsoft Road", font, new Microsoft.RoadProvider(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Microsoft Hybrid", font, new Microsoft.HybridProvider(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Open Street Maps", font, new OpenStreetMaps(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Cloudmade Tourist", font, new CloudMade.Tourist(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Blue Marble", font, new BlueMarble(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    list.addListElement(this.createListCell("Daily Planet", font, new DailyPlanet(), cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
   
    MultiPurposeInterpolator in = new MultiPurposeInterpolator(0,170, 700, 0.1f, 0.7f, 1);
    final Animation slideOut = new Animation("slide out animation", in, mapMenu);
    slideOut.addAnimationListener(new IAnimationListener() {
      public void processAnimationEvent(AnimationEvent ae) {
        float delta = ae.getCurrentStepDelta();
        ((IMTComponent3D)ae.getTargetObject()).translateGlobal(new Vector3D(delta,0,0));
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_ENDED:
          doSlideIn = true;
          animationRunning = false;
          break;
        }
      }
    });
   
    final Animation slideIn = new Animation("slide out animation", in, mapMenu);
    slideIn.addAnimationListener(new IAnimationListener() {
      public void processAnimationEvent(AnimationEvent ae) {
        float delta = -ae.getCurrentStepDelta();
        ((IMTComponent3D)ae.getTargetObject()).translateGlobal(new Vector3D(delta,0,0));
        switch (ae.getId()) {
        case AnimationEvent.ANIMATION_ENDED:
          doSlideIn = false;
          animationRunning = false;
          break;
        }
      }
    });
   
    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){
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

    this.pf = new PuzzleFactory(getMTApplication());
   
    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()){
          if (list.isVisible()){
            list.setVisible(false);
          }else{
            list.setVisible(true);
          }
        }
        return false;
      }
    });
    r.setPositionGlobal(new Vector3D(r.getWidthXY(TransformSpace.GLOBAL)/2f + 3 , r.getHeightXY(TransformSpace.GLOBAL)/2f + 3));
    this.getCanvas().addChild(r);
   
    //Image list
    float cellWidth = 180;
    float cellHeight = 40;
    MTColor cellFillColor = new MTColor(MTColor.BLACK);
    MTColor cellPressedFillColor = new MTColor(new MTColor(105,105,105));
    list = new MTList(r.getWidthXY(TransformSpace.GLOBAL) + 5, 0, cellWidth+2, imagesNames.length* cellHeight + imagesNames.length*3, getMTApplication());
    list.setNoFill(true);
    list.setNoStroke(true);
    list.unregisterAllInputProcessors();
    list.setAnchor(PositionAnchor.UPPER_LEFT);
//    list.setPositionGlobal(Vector3D.ZERO_VECTOR);
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

    this.getCanvas().addChild(loadingScreen);
  }
 
 
  private MTRoundRectangle getRoundRectWithText(float x, float y, float width, float height, String text, IFont font){
    MTRoundRectangle r = new MTRoundRectangle(x, y, 0, width, height, 12, 12, getMTApplication());
    r.unregisterAllInputProcessors();
    r.setFillColor(MTColor.BLACK);
    r.setStrokeColor(MTColor.BLACK);
    MTTextArea rText = new MTTextArea(getMTApplication(), font);
    rText.unregisterAllInputProcessors();
    rText.setPickable(false);
    rText.setNoFill(true);
    rText.setNoStroke(true);
    rText.setText(text);
    r.addChild(rText);
    rText.setPositionRelativeToParent(r.getCenterPointLocal());
    return r;
  }
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

          //we should wrap the actions into an invokeLater runnable which
          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              float arc = ToolsMath.getRandom(8, 25);
              MTRoundRectangle r = new MTRoundRectangle(0,0,0, ToolsMath.getRandom(50, 250),ToolsMath.getRandom(50, 250), arc, arc, instance);
              r.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              r.addGestureListener(DragProcessor.class, new InertiaDragAction());
              instance.getCurrentScene().getCanvas().addChild(r);
              r.setPositionGlobal(new Vector3D(ToolsMath.getRandom(0, instance.width), ToolsMath.getRandom(0, instance.height)));
            }
          });
         
        }
      }
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

        if (rx != 0.0f || ry != 0.0f){
          if (rx > width/2 )
            rx = width/2;
          if (ry > height/2 )
            ry = height/2;
          comp = new MTRoundRectangle(x,y,0, width,height,rx, ry, pa);
        }else{
          comp = new MTRectangle(x,y, width,height, pa);
        }
       
        try{
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

      knobWidth = width - 2*innerPadding;
      knobHeight = knobWidth;
    }
   
//    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) {
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

      return;
    }
    this.registerGlobalInputProcessor(new CursorTracer(mtApplication, this));
   
    //Create window frame
        MTRoundRectangle frame = new MTRoundRectangle(-50,-50, 0, pa.width+100, pa.height+100, 25,25, pa);
        frame.setSizeXYGlobal(pa.width-10, pa.height-10);
        this.getCanvas().addChild(frame);
        //Create the scene in which we actually draw
        drawingScene = new DrawSurfaceScene(pa, "DrawSurface Scene");
        drawingScene.setClear(false);
      
        //Create texture brush
        PImage brushImage = getMTApplication().loadImage(imagesPath + "brush1.png");
    textureBrush = new MTRectangle(brushImage, getMTApplication());
    textureBrush.setPickable(false);
    textureBrush.setNoFill(false);
    textureBrush.setNoStroke(true);
    textureBrush.setDrawSmooth(true);
    textureBrush.setFillColor(new MTColor(0,0,0));
    //Set texture brush as default
    drawingScene.setBrush(textureBrush);
   
    //Create pencil brush
    pencilBrush = new MTEllipse(pa, new Vector3D(brushImage.width/2f,brushImage.height/2f,0), brushImage.width/2f, brushImage.width/2f, 60);
    pencilBrush.setPickable(false);
    pencilBrush.setNoFill(false);
    pencilBrush.setNoStroke(false);
    pencilBrush.setDrawSmooth(true);
    pencilBrush.setStrokeColor(new MTColor(0, 0, 0, 255));
    pencilBrush.setFillColor(new MTColor(0, 0, 0, 255));
   
        //Create the frame/window that displays the drawing scene through a FBO
//        final MTSceneTexture sceneWindow = new MTSceneTexture(0,0, pa, drawingScene);
    //We have to create a fullscreen fbo in order to save the image uncompressed
    final MTSceneTexture sceneTexture = new MTSceneTexture(pa,0, 0, pa.width, pa.height, drawingScene);
        sceneTexture.getFbo().clear(true, 255, 255, 255, 0, true);
        sceneTexture.setStrokeColor(new MTColor(155,155,155));
        frame.addChild(sceneTexture);
       
        //Eraser button
        PImage eraser = pa.loadImage(imagesPath + "Kde_crystalsvg_eraser.png");
        MTImageButton b = new MTImageButton(eraser, pa);
        b.setNoStroke(true);
        b.translate(new Vector3D(-50,0,0));
        b.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
//          //As we are messing with opengl here, we make sure it happens in the rendering thread
          pa.invokeLater(new Runnable() {
            public void run() {
              sceneTexture.getFbo().clear(true, 255, 255, 255, 0, true);           
            }
          });
        }break;
        default:
          break;
        }
      }
        });
        frame.addChild(b);
       
        //Pen brush selector button
        PImage penIcon = pa.loadImage(imagesPath + "pen.png");
        final MTImageButton penButton = new MTImageButton(penIcon, pa);
        frame.addChild(penButton);
        penButton.translate(new Vector3D(-50f, 65,0));
        penButton.setNoStroke(true);
        penButton.setStrokeColor(new MTColor(0,0,0));
       
        //Texture brush selector button
        PImage brushIcon = pa.loadImage(imagesPath + "paintbrush.png");
        final MTImageButton brushButton = new MTImageButton(brushIcon, pa);
        frame.addChild(brushButton);
        brushButton.translate(new Vector3D(-50f, 130,0));
        brushButton.setStrokeColor(new MTColor(0,0,0));
        brushButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
          drawingScene.setBrush(textureBrush);
          brushButton.setNoStroke(false);
          penButton.setNoStroke(true);
        }break;
        default:
          break;
        }
      }
        });
       
        penButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
          drawingScene.setBrush(pencilBrush);
          penButton.setNoStroke(false);
          brushButton.setNoStroke(true);
        }break;
        default:
          break;
        }
      }
        });
       
        //Save to file button
        PImage floppyIcon = pa.loadImage(imagesPath + "floppy.png");
        final MTImageButton floppyButton = new MTImageButton(floppyIcon, pa);
        frame.addChild(floppyButton);
        floppyButton.translate(new Vector3D(-50f, 260,0));
        floppyButton.setNoStroke(true);
        floppyButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
//          pa.invokeLater(new Runnable() {
//            public void run() {
//              drawingScene.getCanvas().drawAndUpdateCanvas(pa.g, 0);
//              pa.saveFrame();
//              clear(pa.g);
//            }
//          });
          drawingScene.registerPreDrawAction(new IPreDrawAction() {
            public void processAction() {
              //drawingScene.getCanvas().drawAndUpdateCanvas(pa.g, 0);
              pa.saveFrame();
            }
            public boolean isLoop() {
              return false;
            }
          });
        }break;
        default:
          break;
        }
      }
        });
       
        /////////////////////////
        //ColorPicker and colorpicker button
        PImage colPick = pa.loadImage(imagesPath + "colorcircle.png");
//        final MTColorPicker colorWidget = new MTColorPicker(0, pa.height-colPick.height, colPick, pa);
        final MTColorPicker colorWidget = new MTColorPicker(0, 0, colPick, pa);
        colorWidget.translate(new Vector3D(0f, 135,0));
        colorWidget.setStrokeColor(new MTColor(0,0,0));
        colorWidget.addGestureListener(DragProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        if (ge.getId()== MTGestureEvent.GESTURE_ENDED){
          if (colorWidget.isVisible()){
            colorWidget.setVisible(false);
          }
        }else{
          drawingScene.setBrushColor(colorWidget.getSelectedColor());
        }
        return false;
      }
    });
        frame.addChild(colorWidget);
        colorWidget.setVisible(false);
       
        PImage colPickIcon = pa.loadImage(imagesPath + "ColorPickerIcon.png");
        MTImageButton colPickButton = new MTImageButton(colPickIcon, pa);
        frame.addChild(colPickButton);
        colPickButton.translate(new Vector3D(-50f, 195,0));
        colPickButton.setNoStroke(true);
        colPickButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
          if (colorWidget.isVisible()){
            colorWidget.setVisible(false);
          }else{
            colorWidget.setVisible(true);
            colorWidget.sendToFront();
          }       
        }break;
        default:
          break;
        }
      }
        });
       
        //Add a slider to set the brush width
        MTSlider slider = new MTSlider(0, 0, 200, 38, 0.05f, 2.0f, pa);
        slider.setValue(1.0f);
        frame.addChild(slider);
        slider.rotateZ(new Vector3D(), 90, TransformSpace.LOCAL);
        slider.translate(new Vector3D(-7, 325));
        slider.setStrokeColor(new MTColor(0,0,0));
        slider.setFillColor(new MTColor(220,220,220));
        slider.getKnob().setFillColor(new MTColor(70,70,70));
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

   
    this.setStrokeWeight(1);
   
    if (MT4jSettings.getInstance().isOpenGlMode()){
//      MTRoundRectangle clipRect3 = new MTRoundRectangle(x+0.1f, y+0.1f, z, width - 0.8f, height - 0.8f, arcWidth, arcHeight, applet);
      MTRoundRectangle clipRect = new MTRoundRectangle(x, y, z, width, height, arcWidth, arcHeight, applet);
          clipRect.setNoStroke(true);
          clipRect.setBoundsBehaviour(MTRectangle.BOUNDS_ONLY_CHECK);
         
          GL gl = ((PGraphicsOpenGL)applet.g).gl;
          Clip clipMask = new Clip(gl, clipRect);
          this.setChildClip(clipMask);
    }
View Full Code Here

Examples of org.mt4j.components.visibleComponents.shapes.MTRoundRectangle

       
        MTRectangle r1 = new MTRectangle(10,10, 200,100, getMTApplication());
        getCanvas().addChild(r1);
        assertEquals(getCanvas().getChildren()[3], r1);
       
        MTRoundRectangle roundRect = new MTRoundRectangle(0,0,0, 160, 110, 30,30, getMTApplication());
            getCanvas().addChild(roundRect);
           
        MTEllipse ellipse = new MTEllipse(getMTApplication(), new Vector3D(100,100,0), 160, 80);
        getCanvas().addChild(ellipse);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.