Package net.sf.fysix.object

Examples of net.sf.fysix.object.ShapeHandler


    renderer.addKeyListener(ctrlInput);
    if(levelEditor == true){
      renderer.addMouseListener(editorDisplay.getMouseListener());
      renderer.addMouseMotionListener(editorDisplay.getMouseMotionListener());
    }
    ShapeHandler sh = new ShapeHandler();
    sh.loadShapes(new File("config\\shapes.xml"));
   
    player1 = new PlayerHandler(input1, sh.getShapeByName("classic"));
    player1.enterCreate(world, new Vector2d(0, 0));
    player1.enterInit(world);
    player1.enterPlayActive(world);
    hud1.setPlayerShip(player1);
    pb1.setPlayerShip(player1);
   
    player2 = new PlayerHandler(input2, sh.getShapeByName("modified"));
    player2.enterCreate(world, new Vector2d(0, -400));
    player2.enterInit(world);
    player2.enterPlayActive(world);
    hud2.setPlayerShip(player2);
    pb2.setPlayerShip(player2);
   
    //planet = new Planet(60, AbstractWorldObject.TTL_INFINITE, TypeE.OBJECT_ALIVE);
    testPlanetEnvironment = new TestPlanetEnvironment(new Vector2d(300, 0))// TODO : Test
    //planet.setPosition(new Vector2d(300, 0));
    //world.addObject(planet, false);
   
    // MAP/LEVEL
    if(levelEditor == false){
      ShapeHandler levelLoader = new ShapeHandler();
      levelLoader.loadShapes(new File("config\\level.xml"));
      List<ShapeData> groundShapes = levelLoader.getShapes();
      for (ShapeData sd : Collections.unmodifiableCollection(groundShapes)){
//        System.out.println("SHAPE : len = " + sd.x.length);
        Polygon pShape = new Polygon();
        for(int vx=0;vx<sd.x.length;vx++){
          pShape.addPoint(sd.x[vx]-500, sd.y[vx]-500); // TODO: FIX SIZE TO MAP!!!
View Full Code Here


//    csCopy.setAttachToGrid(cs.isAttachToGrid());
  }
 
  private void saveMap()
  {
    ShapeHandler sh = new ShapeHandler();
    List<IMapObject> mapobjs = refEditor.getIMapObjects();
    for (IMapObject mo : Collections.unmodifiableCollection(mapobjs)){
      if(mo instanceof ShapeMapObject){
//        if(((ShapeMapObject)mo).isSelected()){
//          int choose = JOptionPane.showConfirmDialog(null, "Do u want to save selected shapes?", "Confirm", JOptionPane.INFORMATION_MESSAGE);
//          if(choose == JOptionPane.OK_OPTION){
            ShapeMapObject ptrSMO = (ShapeMapObject)mo;
            int x[] = new int[ptrSMO.getNumberOfVertices()];
            int y[] = new int[ptrSMO.getNumberOfVertices()];
            WorldPos[] wps = ptrSMO.getVertices();
            for(int i=0;wps != null && i<wps.length;i++){
              x[i] = wps[i].getX(); // TODO: Remove world coordinates?!?
              y[i] = wps[i].getY(); // TODO: Remove world coordinates?!?
            }
            sh.setShapeByName(ptrSMO.getShapeId(), x, y);
//          }
//        }
      }
      //FileDialog fd = new FileDialog(new Frame(), "Save selected shapes");
      //sh.saveShapes(new File(fd.getFile()));
      sh.saveShapes(new File("config\\level.xml"));
    }
  }
View Full Code Here

    }
  }
 
  private void loadMap()
  {
    ShapeHandler sh = new ShapeHandler();
    sh.loadShapes(new File("config\\level.xml"));
    List<ShapeData> shapes = sh.getShapes();
    for (ShapeData sd : Collections.unmodifiableCollection(shapes)){
      ShapeMapObject smo = new ShapeMapObject(new DrawSettings()); // TODO: Attach draw settings to GENEREAL (DrawTool)
      for(int i=0;i<sd.x.length;i++){
        WorldPos vertex = new WorldPos(sd.x[i], sd.y[i]);
        smo.addVertex(vertex);
View Full Code Here

    psCopy.setGridHeight(ps.getGridHeight());
  }
 
  private void saveMap()
  {
    ShapeHandler sh = new ShapeHandler();
    List<IMapObject> mapobjs = refEditor.getIMapObjects();
    for (IMapObject mo : Collections.unmodifiableCollection(mapobjs)){
      if(mo instanceof ShapeMapObject){
        //        if(((ShapeMapObject)mo).isSelected()){
        //          int choose = JOptionPane.showConfirmDialog(null, "Do u want to save selected shapes?", "Confirm", JOptionPane.INFORMATION_MESSAGE);
        //          if(choose == JOptionPane.OK_OPTION){
        ShapeMapObject ptrSMO = (ShapeMapObject)mo;
        int x[] = new int[ptrSMO.getNumberOfVertices()];
        int y[] = new int[ptrSMO.getNumberOfVertices()];
        WorldPos[] wps = ptrSMO.getVertices();
        for(int i=0;wps != null && i<wps.length;i++){
          x[i] = wps[i].getX(); // TODO: Remove world coordinates?!?
          y[i] = wps[i].getY(); // TODO: Remove world coordinates?!?
        }
        sh.setShapeByName(ptrSMO.getShapeId(), x, y);
        //          }
        //        }
      }
      //FileDialog fd = new FileDialog(new Frame(), "Save selected shapes");
      //sh.saveShapes(new File(fd.getFile()));
      sh.saveShapes(new File("config\\level.xml"));
    }
  }
View Full Code Here

    }
  }

  private void loadMap()
  {
    ShapeHandler sh = new ShapeHandler();
    sh.loadShapes(new File("config\\level.xml"));
    List<ShapeData> shapes = sh.getShapes();
    for (ShapeData sd : Collections.unmodifiableCollection(shapes)){
      ShapeMapObject smo = new ShapeMapObject(new DrawSettings()); // TODO: Attach draw settings to GENEREAL (DrawTool)
      for(int i=0;i<sd.x.length;i++){
        WorldPos vertex = new WorldPos(sd.x[i], sd.y[i]);
        smo.addVertex(vertex);
View Full Code Here

TOP

Related Classes of net.sf.fysix.object.ShapeHandler

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.