Ejemplo n.º 1
0
 public void exportHeightmapImage(File file) {
   if (_map != null) {
     HeightMapExporter hm = new HeightMapExporter(_map.getMapWidth(), _map.getMapHeight());
     hm.ProcessMap(_map, _preferences);
     hm.SaveImageHeightmap(file);
   }
 }
Ejemplo n.º 2
0
  private void notifyNewMapLoaded() {

    notifyCellDeSelected();
    notifyNewMap(_map.getMapWidth(), _map.getMapHeight());

    _posSelected = null;

    Position pos = null;

    for (int x = 0; x < _map.getMapWidth(); x++)
      for (int y = 0; y < _map.getMapHeight(); y++) {

        pos = new Position(x, y);
        notifyCellChanged(pos, _map.getCell(pos).getType());

        int entityID = _map.getCell(pos).getEntity();

        if (entityID != 0) {

          Position entityPos = _map.getCell(pos).getPrimaryEntity();

          EntityType entityType = _map.getEntity(entityID).getType();

          Position[] posList =
              new Position
                  [_preferences.getEntityHeight(entityType)
                      * _preferences.getEntityWidth(entityType)];

          int i = 0;

          for (int xEntity = entityPos.getX();
              xEntity < (entityPos.getX() + _preferences.getEntityWidth(entityType));
              xEntity++)
            for (int yEntity = entityPos.getY();
                yEntity < (entityPos.getY() + _preferences.getEntityHeight(entityType));
                yEntity++) {

              posList[i] = new Position(xEntity, yEntity);
              i++;
            }

          notifyNewEntity(posList, entityType);
        }
      }
  }