use of games.strategy.triplea.util.Stopwatch in project triplea by triplea-game.
the class HeadlessUiContext method internalSetMapDir.
@Override
protected void internalSetMapDir(final String dir, final GameData data) {
final Stopwatch stopWatch = new Stopwatch(logger, Level.FINE, "Loading UI Context");
resourceLoader = ResourceLoader.getMapResourceLoader(dir);
scale = getPreferencesMapOrSkin(dir).getDouble(MAP_SCALE_PREF, 1);
mapDir = dir;
stopWatch.done();
}
use of games.strategy.triplea.util.Stopwatch in project triplea by triplea-game.
the class Tile method draw.
private void draw(final Graphics2D g, final GameData data, final MapData mapData) {
final AffineTransform unscaled = g.getTransform();
final AffineTransform scaled;
if (scale != 1) {
scaled = new AffineTransform();
scaled.scale(scale, scale);
g.setTransform(scaled);
} else {
scaled = unscaled;
}
final Stopwatch stopWatch = new Stopwatch(logger, Level.FINEST, "Drawing Tile at" + bounds);
// clear
g.setColor(Color.BLACK);
g.fill(new Rectangle(0, 0, TileManager.TILE_SIZE, TileManager.TILE_SIZE));
contents.sort(Comparator.comparingInt(IDrawable::getLevel));
for (final IDrawable drawable : contents) {
drawable.draw(bounds, data, g, mapData, unscaled, scaled);
}
isDirty = false;
// draw debug graphics
if (DRAW_DEBUG) {
g.setColor(Color.PINK);
final Rectangle r = new Rectangle(1, 1, TileManager.TILE_SIZE - 2, TileManager.TILE_SIZE - 2);
g.setStroke(new BasicStroke(1));
g.draw(r);
g.setFont(new Font("Ariel", Font.BOLD, 25));
g.drawString(x + " " + y, 40, 40);
}
stopWatch.done();
}
Aggregations