Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Rectangle


        }

      }

      String name = packPrefix + c;
      Rectangle rect = packer.pack(name, pixmap);

      // determine which page it was packed into
      int pIndex = packer.getPageIndex(name);
      if (pIndex == -1) // we should not get here
        throw new IllegalStateException("packer was not able to insert '" + name + "' into a page");
View Full Code Here


        }

      }

      String name = packPrefix + c;
      Rectangle rect = packer.pack(name, pixmap);

      // determine which page it was packed into
      int pIndex = packer.getPageIndex(name);
      if (pIndex == -1) // we should not get here
        throw new IllegalStateException("packer was not able to insert '" + name + "' into a page");
View Full Code Here

    if (disposed) return null;
    if (getRect(name) != null) throw new RuntimeException("Key with name '" + name + "' is already in map");
    int borderPixels = padding + (duplicateBorder ? 1 : 0);
    borderPixels <<= 1;

    Rectangle rect = new Rectangle(0, 0, image.getWidth() + borderPixels, image.getHeight() + borderPixels);
    if (rect.getWidth() > pageWidth || rect.getHeight() > pageHeight)
      throw new GdxRuntimeException("page size for '" + name + "' to small");
   
    Node node = insert(currPage.root, rect);

    if (node == null) {
      newPage();
      return pack(name, image);
    }

    node.leaveName = name;
    rect = new Rectangle(node.rect);
    rect.width -= borderPixels;
    rect.height -= borderPixels;
    borderPixels >>= 1;
    rect.x += borderPixels;
    rect.y += borderPixels;
View Full Code Here

  /** @param name the name of the image
   * @return the rectangle for the image in the page it's stored in or null */
  public synchronized Rectangle getRect (String name) {
    for (Page page : pages) {
      Rectangle rect = page.rects.get(name);
      if (rect != null) return rect;
    }
    return null;
  }
View Full Code Here

  /** @param name the name of the image
   * @return the page the image is stored in or null */
  public synchronized Page getPage (String name) {
    for (Page page : pages) {
      Rectangle rect = page.rects.get(name);
      if (rect != null) return page;
    }
    return null;
  }
View Full Code Here

  /** Returns the index of the page containing the given packed rectangle.
   * @param name the name of the image
   * @return the index of the page the image is stored in or -1 */
  public synchronized int getPageIndex (String name) {
    for (int i=0; i<pages.size; i++) {
      Rectangle rect = pages.get(i).rects.get(name);
      if (rect != null) return i;
    }
    return -1;
  }
View Full Code Here

        };
        texture.setFilter(minFilter, magFilter);

        Keys<String> names = page.rects.keys();
        for (String name : names) {
          Rectangle rect = page.rects.get(name);
          TextureRegion region = new TextureRegion(texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
          atlas.addRegion(name, region);
        }
      }
    }
View Full Code Here

            }
          };
          page.texture.setFilter(minFilter, magFilter);

          for (String name : page.addedRects) {
            Rectangle rect = page.rects.get(name);
            TextureRegion region = new TextureRegion(page.texture, (int)rect.x, (int)rect.y, (int)rect.width,
              (int)rect.height);
            atlas.addRegion(name, region);
          }
          page.addedRects.clear();
        }
      } else {
        if (page.addedRects.size > 0) {
          page.texture.load(page.texture.getTextureData());
          for (String name : page.addedRects) {
            Rectangle rect = page.rects.get(name);
            TextureRegion region = new TextureRegion(page.texture, (int)rect.x, (int)rect.y, (int)rect.width,
              (int)rect.height);
            atlas.addRegion(name, region);
          }
          page.addedRects.clear();
View Full Code Here

    public Node rightChild;
    public Rectangle rect;
    public String leaveName;

    public Node (int x, int y, int width, int height, Node leftChild, Node rightChild, String leaveName) {
      this.rect = new Rectangle(x, y, width, height);
      this.leftChild = leftChild;
      this.rightChild = rightChild;
      this.leaveName = leaveName;
    }
View Full Code Here

      this.rightChild = rightChild;
      this.leaveName = leaveName;
    }

    public Node () {
      rect = new Rectangle();
    }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.math.Rectangle

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.