Examples of NamedPolygon


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

      x = getInset().left+30;
      int footerWidth = bg.getWidth()-getInset().left-getInset().right-2*30;
      x += 3*footerWidth/4;
      // close
      g2d.drawImage(waxSeal, x,y-(int)(positions.lineHeight*0.8), null);
      NamedPolygon polygon = new NamedPolygon("Close");
      polygon.addPoint(topLeft.x+x, topLeft.y+y-(int)(positions.lineHeight*0.8));
      polygon.addPoint(topLeft.x+x+waxSeal.getWidth(), topLeft.y+y-(int)(positions.lineHeight*0.8));
      polygon.addPoint(topLeft.x+x+waxSeal.getWidth(), topLeft.y+y-(int)(positions.lineHeight*0.8)+waxSeal.getHeight());
      polygon.addPoint(topLeft.x+x, topLeft.y+y-(int)(positions.lineHeight*0.8)+waxSeal.getHeight());
      footerPolygons.add(polygon, new CloseAction(this));
      g2d.setColor(new Color(0xEA,0xC1,0x17)); // Gold
      gv = opPainter.createGlyphVector(g2d, "X", 18);
      int xPadding = imageUtils.computeCenterAlignX(x, waxSeal.getWidth(), (int)gv.getVisualBounds().getWidth());
      g2d.drawGlyphVector(gv, xPadding, y); // centeralign
View Full Code Here

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

  private void initPolygons() {
    final Rectangle bounds = getBounds();
    final Insets insets = getInsets();
    final int x =bounds.x+bounds.width-scrollDown.getWidth()-insets.right;
    int y = bounds.y+insets.top;
    NamedPolygon poly = new NamedPolygon("scrollUp");
    poly.addPoint(x, y);
    poly.addPoint(x+scrollUp.getWidth(), y);
    poly.addPoint(x+scrollUp.getWidth(), y+scrollUp.getHeight());
    poly.addPoint(x, y+scrollUp.getHeight());
    polygons.add(poly, new ScrollUpAction());
   
    y = getBounds().y+bounds.height-insets.bottom-scrollDown.getHeight();
    poly = new NamedPolygon("scrollDown");
    poly.addPoint(x, y);
    poly.addPoint(x+scrollDown.getWidth(), y);
    poly.addPoint(x+scrollDown.getWidth(), y+scrollDown.getHeight());
    poly.addPoint(x, y+scrollDown.getHeight());
    polygons.add(poly, new ScrollDownAction());
  }
View Full Code Here

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

   * @param polyName name of the Polygon
   * @param action to be executed when run.
   */
  private void addOffsetPolygon(final Rectangle bounds, GlyphVector gv,
      int x, int y, String polyName, Runnable action) {
    NamedPolygon polygon = new NamedPolygon(polyName);
    Rectangle rect = gv.getVisualBounds().getBounds();
    polygon.addPoint(bounds.x+x, bounds.y+y+rect.y);
    polygon.addPoint(bounds.x+x+rect.width, bounds.y+y+rect.y);
    polygon.addPoint(bounds.x+x+rect.width, bounds.y+y+rect.y+rect.height);
    polygon.addPoint(bounds.x+x, bounds.y+y+rect.y+rect.height);
    offsetPolys.add(polygon, action);
  }
View Full Code Here

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

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

        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
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.