Skip to content

Instantly share code, notes, and snippets.

@CalebWhiting
Created March 20, 2015 15:53
Show Gist options
  • Save CalebWhiting/9a4767508831ea5dc0da to your computer and use it in GitHub Desktop.
Save CalebWhiting/9a4767508831ea5dc0da to your computer and use it in GitHub Desktop.
import javax.imageio.*;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
public class ArenaTest {
public static final Arena TEST_ARENA = new Arena(5, 4, 9, 2, new int[][] {
{2, 0, 0, 2, 0, 0, 0, 0, 0, 0},
{0, 0, 4, 0, 0, 0, 4, 0, 2, 0},
{0, 2, 2, 0, 4, 0, 6, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 4, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 2, 0, 0, 0, 0, 0},
{0, 2, 0, 0, 4, 0, 0, 2, 2, 0},
{0, 0, 2, 0, 0, 0, 4, 0, 0, 4},
{4, 4, 4, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 0, 0, 0, 0, 0, 4, 0, 4}
});
public static void main(String[] args) {
int tileSize = 20;
int imageWidth = 10 * tileSize;
int imageHeight = 10 * tileSize;
BufferedImage buffer = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics g = buffer.getGraphics();
TEST_ARENA.paint(g, tileSize);
try {
ImageIO.write(buffer, "png", new File("./debug.png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment