Package libshapedraw

Examples of libshapedraw.LibShapeDraw


    @Override
    public void load() {
        // We could have just as easily set up the API in the constructor
        // instead; LibShapeDraw is designed to be as flexible as possible.
        libShapeDraw = new LibShapeDraw();
        WireframeCuboid box = new WireframeCuboid(0,63,0, 1,64,1);
        box.setLineStyle(Color.CYAN.copy(), 2.0F, true);
        libShapeDraw.addShape(box);

        // Prefer a functional coding style? This is the equivalent of the above:
View Full Code Here


        }

        // One other worthwhile sanity check is to call the verifyInitialized()
        // method, which ensures that ModLoader or Forge has successfully
        // initialized LibShapeDraw. See the method's Javadoc for more details.
        LibShapeDraw libShapeDraw = new LibShapeDraw().verifyInitialized();
        WireframeCuboid box = new WireframeCuboid(2,63,0, 3,64,1);
        box.setLineStyle(Color.ROYAL_BLUE.copy(), 2.0F, true);
        libShapeDraw.addShape(box);
    }
View Full Code Here

    @Override
    public void load() {
        // We actually don't have to keep a reference to the LibShapeDraw API
        // instance as it's also accessible in the handler methods via
        // event.getAPI().
        libShapeDraw = new LibShapeDraw().verifyInitialized().addEventListener(this).setVisibleWhenHidingGui(true);
    }
View Full Code Here

        return "demo";
    }

    @Override
    public void load() {
        new LibShapeDraw().verifyInitialized().addEventListener(this);
    }
View Full Code Here

        return "demo";
    }

    @Override
    public void load() {
        libShapeDraw = new LibShapeDraw()
        .verifyInitialized()
        .addEventListener(this)
        .setVisible(false)
        .setVisibleWhenHidingGui(true);
View Full Code Here

        return "demo";
    }

    @Override
    public void load() {
        libShapeDraw = new LibShapeDraw().verifyInitialized();

        MyShape myShape = new MyShape(
                new Vector3(20, 63, 20),
                Color.INDIGO.copy().setAlpha(0.75));
        libShapeDraw.addShape(myShape);
View Full Code Here

        new MockShape().addTransform(null);
    }

    @Test
    public void testOnAddAndOnRemove() {
        LibShapeDraw api0 = new LibShapeDraw();
        MockShape shape = new MockShape();

        shape.assertAddRemoveCounts(0, 0);

        api0.addShape(shape);
        shape.assertAddRemoveCounts(1, 0);

        api0.addShape(shape);
        shape.assertAddRemoveCounts(1, 0);

        api0.removeShape(shape);
        shape.assertAddRemoveCounts(1, 1);

        api0.removeShape(shape);
        shape.assertAddRemoveCounts(1, 1);

        api0.addShape(shape);
        shape.assertAddRemoveCounts(2, 1);

        // One Shape can be registered with multiple API instances.
        //
        // Use case: a mod can have multiple API instances containing partially
        // overlapping sets of shapes, with only one instance being visible at
        // once. This allows the mod to easily switch things around.
        LibShapeDraw api1 = new LibShapeDraw();

        api1.addShape(shape);
        shape.assertAddRemoveCounts(3, 1);
        assertTrue(api0.getShapes().contains(shape));
        assertTrue(api1.getShapes().contains(shape));

        api0.removeShape(shape);
        shape.assertAddRemoveCounts(3, 2);
        assertFalse(api0.getShapes().contains(shape));
        assertTrue(api1.getShapes().contains(shape));
    }
View Full Code Here

public class TestLibShapeDraw extends SetupTestEnvironment.TestCase {
    private LibShapeDraw lib;

    @Before
    public void registerApi() {
        lib = new LibShapeDraw();
    }
View Full Code Here

        assertTrue(lib.toString().startsWith(lib.getInstanceId()));
    }

    @Test
    public void testInstanceIdUnique() {
        LibShapeDraw lib2 = new LibShapeDraw();
        assertFalse(lib.getInstanceId().equals(lib2.getInstanceId()));
    }
View Full Code Here

    }

    @Test(expected=IllegalStateException.class)
    public void testRegisterApiInstanceInvalidExists() {
        // LibShapeDraw's takes care of registering itself with the internal controller...
        LibShapeDraw api = new LibShapeDraw();
        // ...so it's an error to reregister it.
        ct.registerApiInstance(api, "wat");
    }
View Full Code Here

TOP

Related Classes of libshapedraw.LibShapeDraw

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.