示例#1
0
文件: MapDisplay.java 项目: jufey/AoA
  public MapDisplay(
      String level, String picpath, String shadowpath, int col, int row, GamePanel p) {
    tiles = new Vector<Tile>();

    parent = (Game) p;

    loadLevelData(level);

    control = ImageControl.getInstance();
    control.setSourceImage(picpath, col, row);
    control.setShadowImage(shadowpath, col, row);
    display = new Rectangle2D.Double(0, 0, parent.getWidth(), parent.getHeight());
  }
示例#2
0
文件: MapDisplay.java 项目: jufey/AoA
  public void drawVisibleMap(Graphics g) {
    for (Tile t : tiles) {
      if (t.intersects(display)) {
        double dx = t.x - display.getX();
        double dy = t.y - display.getY();

        g.drawImage((Image) (control.getImageAt(t.getImageNumber())), (int) dx, (int) dy, null);
      }
    }
  }
示例#3
0
文件: MapDisplay.java 项目: jufey/AoA
  public Color getColorForPoint(Point p) {
    for (Tile t : tiles) {
      double dx = t.x - display.getX();
      double dy = t.y - display.getY();

      Rectangle temp2 = new Rectangle((int) dx, (int) dy, (int) t.getWidth(), (int) t.getHeight());

      if (temp2.contains(p)) {
        int px = (int) (p.x - dx);
        int py = (int) (p.y - dy);

        Color c =
            new Color(
                ImageControl.getInstance().getShadowImageAt(t.getImageNumber()).getRGB(px, py));
        return c;
      }
    }
    return null;
  }