Skip to content

Amoebrick 1.1

Latest

Choose a tag to compare

@damoebe damoebe released this 28 Jan 20:04
· 12 commits to master since this release
  1. Added new constructor for the BrickImage class. You are now able to provide a HashMap of available elements and the BrickImage object will only use these elements to generate itself. This can be helpful, if you already own some bricks and do not want to buy new ones.
  2. Furthermore, you can choose, if you want to exclude transparent bricks from your BrickImage Object by setting allowTransparentBricks to false at the end of the main constructor.

You can find more details in the documentation.

public static void main(String[] args){
        // demo
        BrickImage brickImage1 = new BrickImage(48, 48, new ImageIcon(System.getProperty("user.home") 
                + "\\Downloads\\Stonetemplepilotspurple.png").getImage(), false);
        test("first", brickImage1);
        Map<String, Integer> elements = new HashMap<>();
        elements.put("4169428", (48*48)/3);
        elements.put("6236772", (48*48)/3);
        elements.put("6514207", (48*48)/3);
        BrickImage brickImage2 = new BrickImage(48, 48, new ImageIcon(System.getProperty("user.home") + 
                "\\Downloads\\Stonetemplepilotspurple.png").getImage(), elements);
        test("second", brickImage2);
}

private static void test(String name, BrickImage brickImage){
        JFrame frame = new JFrame(name);
        frame.add(new JLabel(new ImageIcon(brickImage.getImage(10))));
        frame.setSize(1000, 1000);
        frame.setVisible(true);
        System.out.println(brickImage.getElementsSorted());
        System.out.println("Part Variations:" + brickImage.getElementsSorted().size());
        System.out.println(brickImage.getStats());
}