Package org.mt4j.util

Examples of org.mt4j.util.MTColor


  public Models3DScene(MTApplication mtApplication, String name) {
    super(mtApplication, name);
    mtApp = mtApplication;
   
    this.setClearColor(new MTColor(40,40,40,255));
   
    this.registerGlobalInputProcessor(new CursorTracer(mtApp, this));
   
    //Make canvas zoomable
    this.getCanvas().registerInputProcessor(new ZoomProcessor(mtApp));
View Full Code Here


    if (!MT4jSettings.getInstance().isOpenGlMode()){
      System.err.println("Scene only usable when using the OpenGL renderer! - See settings.txt");
          return;
        }
   
    this.setClearColor(new MTColor(200, 200, 200, 255));
    this.registerGlobalInputProcessor(new CursorTracer(pa, this));
   
    //Add a background image for the scene
    this.getCanvas().addChild(new MTBackgroundImage(pa, pa.loadImage(imagesPath + "3040.jpg"), true));
   
View Full Code Here

         
          //Set the texture
          tile.setTexture(p);
//          tile.setNoStroke(true);
//          tile.setStrokeColor(MTColor.GREY);
          tile.setStrokeColor(new MTColor(80,80,80));
          tile.setStrokeWeight(0.7f);
         
          tiles.add(tile);
        }
       
View Full Code Here

   
    this.registerGlobalInputProcessor(new CursorTracer(app, this));
   
//    this.setClearColor(new MTColor(230,230,230,255));
//    this.setClearColor(new MTColor(30,30,30,255));
    this.setClearColor(new MTColor(0,0,0,255));
   
    //BACKGROUND GRADIENT
    if (this.useBackgroundGradient){
      Vertex[] vertices = new Vertex[]{
          new Vertex(0,       app.height/3f0,   0,0,0,255),
          new Vertex(app.width,   app.height/30,   0,0,0,255),
          new Vertex(app.width,   app.height/1.7f,0170,170,140,255),
          new Vertex(0,      app.height/1.7f,0170,170,140,255),
          new Vertex(0,       app.height/300,0,0,255),
      };
      MTPolygon p = new MTPolygon(vertices, getMTApplication());
      p.setName("upper gradient");
      p.setNoStroke(true);
      p.generateAndUseDisplayLists();
      p.setPickable(false);
      this.getCanvas().addChild(p);
     
      Vertex[] vertices2 = new Vertex[]{
          new Vertex(0,       app.height/1.7f0,   170,170,140,255),
          new Vertex(app.width,   app.height/1.7f0,   170,170,140,255),
          new Vertex(app.width,   app.height,      00,0,0,255),
          new Vertex(0,      app.height,      00,0,0,255),
          new Vertex(0,       app.height/1.7f0,   170,170,140,255),
      };
      MTPolygon p2 = new MTPolygon(vertices2, getMTApplication());
      p2.setNoStroke(true);
      p2.generateAndUseDisplayLists();
      p2.setPickable(false);
      this.getCanvas().addChild(p2);
    }
    //BACKGROUND
   
    preferredIconWidth = 256;
    preferredIconHeight = 192;
    gapBetweenIconAndReflection = 9;
    displayHeightOfReflection = preferredIconHeight * 0.6f;
   
    //CREATE LIST
    listWidth = preferredIconHeight + displayHeightOfReflection + gapBetweenIconAndReflection;
//    listHeight = app.width - 50;
    listHeight = app.width;
    list = new MTList(0,0, listWidth, listHeight, 40, mtApplication);
    list.setFillColor(new MTColor(150,150,150,200));
    list.setNoFill(true);
    list.setNoStroke(true);
   
    /*
    //List ends fade images //Background gradient has to be set to false!
View Full Code Here

            if (hasFBO && scene instanceof AbstractScene){
              ((AbstractScene) scene).setTransition(new BlendTransition(app, 300))
            }
           
            final MTSceneWindow sceneWindow = new MTSceneWindow(scene, 100,50, app);
            sceneWindow.setFillColor(new MTColor(50,50,50,200));
            sceneWindow.scaleGlobal(0.5f, 0.5f, 0.5f, sceneWindow.getCenterPointGlobal());
            sceneWindow.addGestureListener(DragProcessor.class, new InertiaDragAction());
            getCanvas().addChild(sceneWindow);
          }else{
            //No FBO available -> change to the new scene fullscreen directly
View Full Code Here

    };
    MTPolygon p = new MTPolygon(vertices, getMTApplication());
    p.setTexture(icon);
//    p.setNoStroke(true);
//    p.setStrokeColor(new MTColor(150,150,150, 255));
    p.setStrokeColor(new MTColor(80,80,80, 255));
   
    Vertex[] verticesRef = new Vertex[]{
        new Vertex(listCellWidth - icon.height - reflectionDistanceFromImage,                    border,  0,   0,0),
        new Vertex(listCellWidth - icon.height - reflectionDistanceFromImage,            listCellHeight -border,  0,   1,0),
        new Vertex(listCellWidth - icon.height - reflection.height - reflectionDistanceFromImage,   listCellHeight -border,  0,   1,1),
        new Vertex(listCellWidth - icon.height - reflection.height - reflectionDistanceFromImage,        border,  0,   0,1),
        new Vertex(listCellWidth - icon.height - reflectionDistanceFromImage,                   border,  0,   0,0),
    };
    MTPolygon pRef = new MTPolygon(verticesRef, getMTApplication());
    pRef.setTexture(reflection);
    pRef.setNoStroke(true);
   
    cell.addChild(p);
    cell.addChild(pRef);
   
    list.addListElement(cell);
    addTapProcessor(cell, sceneToCreate);
//    */
   
    /*
    MTRectangle rect = new MTRectangle(icon, getMTApplication());
    rect.setUseDirectGL(true);
//    rect.setNoStroke(true);
    rect.rotateZ(rect.getCenterPointLocal(), 90, TransformSpace.LOCAL);
   
    MTRectangle reflectionRect = new MTRectangle(0, height, width, height, getMTApplication());
    reflectionRect.setTexture(reflection);
    reflectionRect.setUseDirectGL(true);
//    reflectionRect.setNoStroke(true);
    reflectionRect.rotateZ(rect.getCenterPointLocal(), 90, TransformSpace.LOCAL);
   
    cell.addChild(rect);
    cell.addChild(reflectionRect);
    list.addListElement(cell);
    addTapProcessor(cell, sceneToCreate);
   
    rect.setAnchor(PositionAnchor.UPPER_LEFT);
    reflectionRect.setAnchor(PositionAnchor.UPPER_LEFT);
   
    PositionAnchor oldCellAnchor = cell.getAnchor();
    cell.setAnchor(PositionAnchor.UPPER_LEFT);
   
    rect.setPositionRelativeToParent(cell.getPosition(TransformSpace.LOCAL));
    rect.translate(new Vector3D(realListCellWidth - topShift, 0));
   
    reflectionRect.setPositionRelativeToParent(cell.getPosition(TransformSpace.LOCAL));
    reflectionRect.translate(new Vector3D(realListCellWidth - topShift - icon.height - gapBetweenIconAndReflection, 0));
   
    cell.setAnchor(oldCellAnchor);
   
//    rect.setPositionRelativeToParent(cell.getCenterPointLocal());
   
//    MTRoundRectangle r = new MTRoundRectangle(0, 0, 0, listCellWidth, listCellHeight, 30, 30, getMTApplication());
//    cell.addChild(r);
   
//    getCanvas().addChild(rect);
    */
   
    ///Add scene title
    MTTextArea text = new MTTextArea(app, font);
    text.setFillColor(new MTColor(150,150,250,200));
    text.setNoFill(true);
    text.setNoStroke(true);
    text.setText(sceneToCreate.getTitle());
    text.rotateZ(text.getCenterPointLocal(), 90, TransformSpace.LOCAL);
    cell.addChild(text);
View Full Code Here

        int crosses[] = gesture.crosses;
       
        if (this.isNoStroke())
          g.noStroke();
        else{
          MTColor strokeCol = gesture.getColor();
          g.strokeWeight(this.getStrokeWeight());
          g.stroke(strokeCol.getR(), strokeCol.getG(), strokeCol.getB(), strokeCol.getAlpha());
        }
       
        if (this.isNoFill())
          g.noFill();
        else{
          MTColor fillCol = gesture.getColor();
          g.fill(fillCol.getR(), fillCol.getG(), fillCol.getB(), fillCol.getAlpha());
        }

        int xpts[];
        int ypts[];
        Polygon p;
        int cr;
       
        //FIXME TEST
        if (useTexture){
          MTColor c = gesture.getColor();
          g.tint(c.getR(), c.getG(), c.getB(), c.getAlpha());
        }

        g.beginShape(PApplet.QUADS);
       
        if (useTexture){
View Full Code Here

    super(mtApplication, name);
    if (!MT4jSettings.getInstance().isOpenGlMode()){
      System.err.println(this.getName() + " is only usable with the OpenGL renderer.");
    }

    this.setClearColor(new MTColor(55,55,55));
    this.registerGlobalInputProcessor(new CursorTracer(mtApplication, this));
    this.getCanvas().setDepthBufferDisabled(true); //to avoid display errors because everything is 2D
   
    MTBackgroundImage background = new MTBackgroundImage(mtApplication, mtApplication.loadImage(imagesPath + "webtreats_wood-pattern1-512d.jpg") , true);
    this.getCanvas().addChild(background);
   
    this.puzzleGroup = new MTComponent(mtApplication);
    this.getCanvas().addChild(puzzleGroup);
   
    //Puzzle tile factory
    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);
    list.setVisible(false);
    for (int i = 0; i < imagesNames.length; i++) {
      String imageName = imagesNames[i];
      list.addListElement(this.createListCell(imageName, font, cellWidth, cellHeight, cellFillColor, cellPressedFillColor));
    }
    this.getCanvas().addChild(list);
   
    //Loading window
    this.loadingScreen = getRoundRectWithText(0, 0, 130, 45, "  Loading...", font);
    this.loadingScreen.setFillColor(new MTColor(0,0,0,200));
    this.loadingScreen.setStrokeColor(new MTColor(0,0,0,200));
    this.loadingScreen.setPickable(false);
    this.loadingScreen.setPositionGlobal(MT4jSettings.getInstance().getWindowCenter());
    this.loadingScreen.setVisible(false);
    this.getCanvas().addChild(loadingScreen);
  }
View Full Code Here

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

                  if pointOnScreen.x >= 0 && pointOnScreen.x <= p.width
                    &&  pointOnScreen.y >= 0 && pointOnScreen.y <= p.height
                  ){
                    final MTEllipse tagCircle = new MTEllipse(p, vecOnScreen, 15, 15, 30);
                    tagCircle.setPickable(true);
                    tagCircle.setFillColor(new MTColor(90, 205, 230, 200));
                    tagCircle.setDrawSmooth(true);
                    tagCircle.setStrokeWeight(2);
                    tagCircle.setStrokeColor(new MTColor(40, 130, 220, 255));
                    tagCircle.translate(new Vector3D(pointOnScreen.x, pointOnScreen.y , 0.0f));
                    tagCircle.transform(tagContainer.getGlobalInverseMatrix());
                    tagCircle.setName(id);
                   
                    tagToPhoto.put(tagCircle, foto);
View Full Code Here

TOP

Related Classes of org.mt4j.util.MTColor

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.