Examples of MTListCell


Examples of org.mt4j.components.visibleComponents.widgets.MTListCell

    float listCellWidth = listWidth;   
    float realListCellWidth = listCellWidth - bothBorders;
//    float listCellHeight = preferredIconWidth - border;
    float listCellHeight = preferredIconWidth ;
   
    MTListCell cell = new MTListCell(realListCellWidth ,  listCellHeight, app);
    cell.setNoFill(true);
    cell.setNoStroke(true);
   
//    /*
    Vertex[] vertices = new Vertex[]{
        new Vertex(realListCellWidth-topShift,         border,          0, 0,0),
        new Vertex(realListCellWidth-topShift,          listCellHeight -border,  0, 1,0),
        new Vertex(realListCellWidth-topShift - icon.height, listCellHeight -border,  0, 1,1),
        new Vertex(realListCellWidth-topShift - icon.height,  border,          0, 0,1),
        new Vertex(realListCellWidth-topShift,         border,          0, 0,0),
    };
    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);
   
//    text.setAnchor(PositionAnchor.CENTER);
//    PositionAnchor oldCellAnchor = cell.getAnchor();
//    cell.setAnchor(PositionAnchor.CENTER);
//    text.setPositionRelativeToParent(cell.getPosition(TransformSpace.LOCAL));
//    text.translate(new Vector3D(realListCellWidth - topShift, 0));
//    cell.setAnchor(oldCellAnchor);
   
    text.setPositionRelativeToParent(cell.getCenterPointLocal());
    text.translate(new Vector3D(realListCellWidth*0.5f - text.getHeightXY(TransformSpace.LOCAL)*0.5f, 0));
    ///
  }
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.MTListCell

 
  private boolean animationRunning = false;
  private boolean doSlideIn = false;
 
  private MTListCell createListCell(final String label, IFont font, final AbstractMapProvider mapProvider, float cellWidth, float cellHeight, final MTColor cellFillColor, final MTColor cellPressedFillColor){
    final MTListCell cell = new MTListCell(cellWidth, cellHeight, p);
   
    cell.setChildClip(null); //FIXME TEST, no clipping for performance!
   
    cell.setFillColor(cellFillColor);
    MTTextArea listLabel = new MTTextArea(p, font);
    listLabel.setNoFill(true);
    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:
          cell.setFillColor(cellPressedFillColor);
          break;
        case TapEvent.BUTTON_UP:
          cell.setFillColor(cellFillColor);
          break;
        case TapEvent.BUTTON_CLICKED:
//          System.out.println("Button clicked: " + label);
          cell.setFillColor(cellFillColor);
          map.setMapProvider(mapProvider);
          break;
        }
        return false;
      }
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.MTListCell

    return r;
  }
 
 
  private MTListCell createListCell(final String imageName, IFont font, float cellWidth, float cellHeight, final MTColor cellFillColor, final MTColor cellPressedFillColor){
    final MTListCell cell = new MTListCell(cellWidth, cellHeight, getMTApplication());
    cell.setFillColor(cellFillColor);
    MTTextArea listLabel = new MTTextArea(getMTApplication(), font);
    listLabel.setNoFill(true);
    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:
          cell.setFillColor(cellPressedFillColor);
          break;
        case TapEvent.BUTTON_UP:
          cell.setFillColor(cellFillColor);
          break;
        case TapEvent.BUTTON_CLICKED:
          //System.out.println("Button clicked: " + label);
          cell.setFillColor(cellFillColor);
          list.setVisible(false);
          loadingScreen.setVisible(true);
          registerPreDrawAction(new IPreDrawAction() {
            public void processAction() {
              getMTApplication().invokeLater(new Runnable() {
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.