}
}while(changed);
int tileSize = scene.tileSize;
QPolygonF hmPolygon = new QPolygonF();
// Go down right side, adding profile points
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if (hmTileMap[i][j]
&& (j + 1 > width - 1 || !hmTileMap[i][j + 1])) {
QPointF pTR = new QPointF((j + 1) * tileSize - 1, i
* tileSize - 1);
hmPolygon.add(this.pos().add(pTR));
QPointF pBR = new QPointF((j + 1) * tileSize - 1, (i + 1)
* tileSize - 1);
hmPolygon.add(this.pos().add(pBR));
break;
}
}
}
// Go up left side, adding profile points
for (int i = height - 1; i >= 0; i--) {
for (int j = width - 1; j >= 0; j--) {
if (hmTileMap[i][j] && (j - 1 < 0 || !hmTileMap[i][j - 1])) {
QPointF pBL = new QPointF((j) * tileSize - 1, (i + 1)
* tileSize - 1);
hmPolygon.add(this.pos().add(pBL));
QPointF pTL = new QPointF((j) * tileSize - 1, (i)
* tileSize - 1);
hmPolygon.add(this.pos().add(pTL));
break;
}
}
}
return hmPolygon;