Package ch.sahits.game.graphic.image.model

Examples of ch.sahits.game.graphic.image.model.NamedPolygon


  /**
   * Setting the positions of the polygons on the screen
   */
  private void initStartPolygons() {
    // TODO implement PolygonLoader
    NamedPolygon poly = new NamedPolygon(names[TEXT_FOCUS_NEW]);
    poly.addPoint(offsetter.computeXOffset(590),
        offsetter.computeYOffset(38));
    poly.addPoint(offsetter.computeXOffset(662),
        offsetter.computeYOffset(45));
    poly.addPoint(offsetter.computeXOffset(654),
        offsetter.computeYOffset(74));
    poly.addPoint(offsetter.computeXOffset(585),
        offsetter.computeYOffset(65));
    int meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
    poly = new NamedPolygon(names[TEXT_FOCUS_LOAD]);
    poly.addPoint(offsetter.computeXOffset(565),
        offsetter.computeYOffset(91));
    poly.addPoint(offsetter.computeXOffset(656),
        offsetter.computeYOffset(110));
    poly.addPoint(offsetter.computeXOffset(649),
        offsetter.computeYOffset(148));
    poly.addPoint(offsetter.computeXOffset(552),
        offsetter.computeYOffset(138));
    meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
    poly = new NamedPolygon(names[TEXT_FOCUS_OPTIONS]);
    poly.addPoint(offsetter.computeXOffset(543),
        offsetter.computeYOffset(162));
    poly.addPoint(offsetter.computeXOffset(657),
        offsetter.computeYOffset(193));
    poly.addPoint(offsetter.computeXOffset(648),
        offsetter.computeYOffset(233));
    poly.addPoint(offsetter.computeXOffset(537),
        offsetter.computeYOffset(217));
    meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
    poly = new NamedPolygon(names[TEXT_FOCUS_CREDITS]);
    poly.addPoint(offsetter.computeXOffset(501),
        offsetter.computeYOffset(252));
    poly.addPoint(offsetter.computeXOffset(619),
        offsetter.computeYOffset(285));
    poly.addPoint(offsetter.computeXOffset(603),
        offsetter.computeYOffset(324));
    poly.addPoint(offsetter.computeXOffset(490),
        offsetter.computeYOffset(309));
    meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
    poly = new NamedPolygon(names[TEXT_FOCUS_HISTORY]);
    poly.addPoint(offsetter.computeXOffset(459),
        offsetter.computeYOffset(325));
    poly.addPoint(offsetter.computeXOffset(587),
        offsetter.computeYOffset(365));
    poly.addPoint(offsetter.computeXOffset(574),
        offsetter.computeYOffset(422));
    poly.addPoint(offsetter.computeXOffset(423),
        offsetter.computeYOffset(389));
    meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
    poly = new NamedPolygon(names[TEXT_FOCUS_BACK]);
    poly.addPoint(offsetter.computeXOffset(392),offsetter.computeYOffset(397));
    poly.addPoint(offsetter.computeXOffset(433),offsetter.computeYOffset(408));
    poly.addPoint(offsetter.computeXOffset(427),offsetter.computeYOffset(426));
    poly.addPoint(offsetter.computeXOffset(385),offsetter.computeYOffset(416));
    meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
    poly = new NamedPolygon(names[TEXT_FOCUS_NEXT]);
    poly.addPoint(offsetter.computeXOffset(854),offsetter.computeYOffset(468));
    poly.addPoint(offsetter.computeXOffset(913),offsetter.computeYOffset(484));
    poly.addPoint(offsetter.computeXOffset(913),offsetter.computeYOffset(512));
    poly.addPoint(offsetter.computeXOffset(858),offsetter.computeYOffset(495));
    meanY = (poly.ypoints[0] + poly.ypoints[3]) / 2;
    polygons.put(meanY, poly);
  }
View Full Code Here


        ImageData imgData = new ImageData(name, crop, maxCrop);
        if (polygons!=null){ // it might be an image definition without any polygons defined
          List<Element> polygonList = polygons.getChildren("polygon");
          for (Element polygon : polygonList) {
            String name2 = polygon.getAttributeValue("name");
            NamedPolygon poly = new NamedPolygon(name2);
            int zIndex = 1;
            if (polygon.getAttribute("z-index")!=null){
              zIndex = Integer.parseInt(polygon.getAttributeValue("z-index"));
            }
            List<Element> points = polygon.getChildren("point");
            for (Element point : points) {
              int x = Integer.parseInt(point.getAttributeValue("x"));
              int y = Integer.parseInt(point.getAttributeValue("y"));
              poly.addPoint(x, y);
            }
            imgData.addPolygon(poly,zIndex);
          } // end <polygon>
        } // end extracting all <polygons>
        // Load the image
View Full Code Here

TOP

Related Classes of ch.sahits.game.graphic.image.model.NamedPolygon

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.