Search in sources :

Example 6 with Stopwatch

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();
}
Also used : Stopwatch(games.strategy.triplea.util.Stopwatch)

Example 7 with Stopwatch

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();
}
Also used : BasicStroke(java.awt.BasicStroke) Stopwatch(games.strategy.triplea.util.Stopwatch) Rectangle(java.awt.Rectangle) AffineTransform(java.awt.geom.AffineTransform) IDrawable(games.strategy.triplea.ui.screen.drawable.IDrawable) Font(java.awt.Font)

Aggregations

Stopwatch (games.strategy.triplea.util.Stopwatch)7 AffineTransform (java.awt.geom.AffineTransform)4 Graphics2D (java.awt.Graphics2D)3 Image (java.awt.Image)3 BufferedImage (java.awt.image.BufferedImage)3 Point (java.awt.Point)2 Rectangle (java.awt.Rectangle)2 IOException (java.io.IOException)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 GameData (games.strategy.engine.data.GameData)1 Territory (games.strategy.engine.data.Territory)1 Unit (games.strategy.engine.data.Unit)1 TripleAUnit (games.strategy.triplea.TripleAUnit)1 BlendingMode (games.strategy.triplea.image.BlendComposite.BlendingMode)1 DiceImageFactory (games.strategy.triplea.image.DiceImageFactory)1 MapImage (games.strategy.triplea.image.MapImage)1 MapData (games.strategy.triplea.ui.mapdata.MapData)1 Tile (games.strategy.triplea.ui.screen.Tile)1 IDrawable (games.strategy.triplea.ui.screen.drawable.IDrawable)1