Package com.ardor3d.ui.text

Examples of com.ardor3d.ui.text.BasicText


        final Box sb = new Box("SkyBox", Vector3.ZERO, 50, 50, 50);
        sb.setModelBound(new BoundingBox());
        _root.attachChild(sb);

        final BasicText t1 = BasicText.createDefaultTextLabel("Text1", "[K] Show Skeleton.");
        t1.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        t1.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        t1.setTranslation(new Vector3(5, 0 * (t1.getHeight() + 5) + 10, 0));
        _root.attachChild(t1);
        _root.getSceneHints().setCullHint(CullHint.Never);

        final BasicText t2 = BasicText.createDefaultTextLabel("Text2", "[M] Hide Mesh.");
        t2.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        t2.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        t2.setTranslation(new Vector3(5, 1 * (t2.getHeight() + 5) + 10, 0));
        _root.attachChild(t2);
        _root.getSceneHints().setCullHint(CullHint.Never);

        final BasicText t3 = createTextLabel("Text3", "[U] Use Normal Map.", 2);
        final BasicText t4 = createTextLabel("Text4", "[F] Use Diffuse Map.", 3);
        final BasicText t5 = createTextLabel("Text5", "[P] Use Specular Map.", 4);
        final BasicText t6 = createTextLabel("Text5", "[Y] Enable Light Motion.", 5);

        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.F), new TriggerAction() {
            public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
                useDiffuseMap = !useDiffuseMap;
                gpuShader.setUniform("flags", useNormalMap, useDiffuseMap, useSpecularMap, false);
                if (useDiffuseMap) {
                    t4.setText("[F] Skip Diffuse Map.");
                } else {
                    t4.setText("[F] Use Diffuse Map.");
                }
            }
        }));

        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NUMPADADD), new TriggerAction() {
            public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
                if (quantizationFactor > 1) {
                    quantizationFactor /= 2f;
                }
                gpuShader.setUniform("quantizationFactor", 1f / quantizationFactor);
                System.out.println("quantizationFactor = " + quantizationFactor);
            }
        }));
        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.NUMPADSUBTRACT),
                new TriggerAction() {
                    public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
                        if (quantizationFactor < 512) {
                            quantizationFactor *= 2f;
                        }
                        gpuShader.setUniform("quantizationFactor", 1f / quantizationFactor);
                        System.out.println("quantizationFactor = " + quantizationFactor);
                    }
                }));

        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.Y), new TriggerAction() {
            public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
                updateLight = !updateLight;
                if (updateLight) {
                    t6.setText("[Y] Disable Light Motion.");
                } else {
                    t6.setText("[Y] Enable Light Motion.");
                }
            }
        }));

        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.P), new TriggerAction() {
View Full Code Here


        _root.updateWorldTransform(true);

    }

    private BasicText createTextLabel(final String name, final String text, final int pos) {
        final BasicText t3 = BasicText.createDefaultTextLabel(name, text);
        t3.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        t3.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        t3.setTranslation(new Vector3(5, pos * (t3.getHeight() + 5) + 10, 0));
        _root.attachChild(t3);
        _root.getSceneHints().setCullHint(CullHint.Never);
        return t3;
    }
View Full Code Here

                renderer.setBackgroundColor(ColorRGBA.GRAY);
                return null;
            }
        });

        final BasicText t1 = BasicText.createDefaultTextLabel("Text1", "[K] Show Skeleton.");
        t1.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        t1.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        t1.setTranslation(new Vector3(5, 0 * (t1.getHeight() + 5) + 10, 0));
        _root.attachChild(t1);
        _root.getSceneHints().setCullHint(CullHint.Never);

        final BasicText t2 = BasicText.createDefaultTextLabel("Text2", "[M] Hide Mesh.");
        t2.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        t2.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        t2.setTranslation(new Vector3(5, 1 * (t1.getHeight() + 5) + 10, 0));
        _root.attachChild(t2);
        _root.getSceneHints().setCullHint(CullHint.Never);

        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.K), new TriggerAction() {
            public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
                showSkeleton = !showSkeleton;
                if (showSkeleton) {
                    t1.setText("[K] Hide Skeleton.");
                } else {
                    t1.setText("[K] Show Skeleon.");
                }
            }
        }));

        _logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.M), new TriggerAction() {
            public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
                showMesh = !showMesh;
                colladaNode.getSceneHints().setCullHint(showMesh ? CullHint.Dynamic : CullHint.Always);
                if (showMesh) {
                    t2.setText("[M] Hide Mesh.");
                } else {
                    t2.setText("[M] Show Mesh.");
                }
            }
        }));

        // Add fps display
View Full Code Here

TOP

Related Classes of com.ardor3d.ui.text.BasicText

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.