Package org.mt4j.components

Examples of org.mt4j.components.MTCanvas


    this.name = name;
    this.mtApplication = mtApplication;
    this.sceneCam = new MTCamera(mtApplication);
    this.sceneCam.update();
    this.sceneCam.setZoomMinDistance(60);
    this.mainCanvas = new MTCanvas(mtApplication, name + " - Main Canvas", sceneCam);
   
//    preDrawActions = new LinkedList<IPreDrawAction>();
    preDrawActions = new ArrayDeque<IPreDrawAction>();
   
    this.registerDefaultGlobalInputProcessors();
View Full Code Here


   *
   * @param lastScene the last scene
   * @param newScene the new scene
   */
  private void sceneChange(Iscene lastScene, Iscene newScene){
    MTCanvas oldCanvas = lastScene.getCanvas();
    MTCanvas newCanvas = newScene.getCanvas();
    currentScene = newScene;
   
    System.out.println("Removing multiple mice cursors from old and add to new canvas.");
    Collection<MouseInfo> mouseInfos = deviceToMouseInfo.values();
    for (Iterator<MouseInfo> iter = mouseInfos.iterator(); iter.hasNext();) {
      MouseInfo mouseInfo = (MouseInfo) iter.next();
      if (mouseInfo.ellipse != null){
        float currentEllipseWidth = 6;
        Vector3D v = new Vector3D(currentEllipseWidth,0,0);
        v.transformDirectionVector(currentScene.getCanvas().getGlobalInverseMatrix());
        float newEllipseWidth = currentEllipseWidth = v.length();
        mouseInfo.ellipse.setWidthXYGlobal(newEllipseWidth*2);
        try {
          oldCanvas.removeChild(mouseInfo.ellipse);
        } catch (Exception e) {
          e.printStackTrace();
        }finally{
          newCanvas.addChild(mouseInfo.ellipse);
        }
//        mouseInfo.ellipse.setCustomAndGlobalCam(currentScene.getSceneCam(), defaultCenterCam);
        mouseInfo.ellipse.attachCamera(defaultCenterCam);
      }
    }
View Full Code Here

  /**
   * Adds the to scene.
   */
  public void addToScene(){
    MTComponent cursorTraceContainer = null;
    MTCanvas canvas = scene.getCanvas();
   
    /*
    //Re-use cursor trace group which is always on top for this menu
    MTComponent[] children = canvas.getChildren();
    for (int i = 0; i < children.length; i++) {
      MTComponent component = children[i];
      if (component instanceof MTOverlayContainer
          &&
        component.getName().equalsIgnoreCase("Cursor Trace group")){
        cursorTraceContainer  = component;
        component.addChild(0, this); //add to cursor trace overlay container
      }
    }
    */
   
//    /*
    //cursor tracer group NOT found in the scene -> add overlay container to canvas
    if (cursorTraceContainer == null){
      overlayGroup.addChild(this);
      canvas.addChild(overlayGroup);
    }
//    */
  }
 
View Full Code Here

  /**
   * Removes the from scene.
   */
  public void removeFromScene(){
    MTComponent cursorTraceContainer = null;
    MTCanvas canvas = scene.getCanvas();
   
    /*
    //Re-use cursor trace group which is always on top for this menu
    MTComponent[] children = canvas.getChildren();
    for (int i = 0; i < children.length; i++) {
      MTComponent component = children[i];
      if (component instanceof MTOverlayContainer
          &&
        component.getName().equalsIgnoreCase("Cursor Trace group")){
        cursorTraceContainer  = component;
        if (cursorTraceContainer.containsChild(this)){
          cursorTraceContainer.removeChild(this);
        }
      }
    }
    */
   
//    /*
    //cursor tracer group NOT found in the scene -> add overlay container to canvas
    if (cursorTraceContainer == null){
      if (canvas.containsChild(overlayGroup)){
        canvas.removeChild(overlayGroup);
      }
    }
//    */
  }
 
View Full Code Here

TOP

Related Classes of org.mt4j.components.MTCanvas

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.