Search in sources :

Example 41 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TestComboMoves method simpleInitApp.

@Override
public void simpleInitApp() {
    setDisplayFps(false);
    setDisplayStatView(false);
    // Create debug text
    BitmapText helpText = new BitmapText(guiFont);
    helpText.setLocalTranslation(0, settings.getHeight(), 0);
    helpText.setText("Moves:\n" + "Fireball: Down, Down+Right, Right\n" + "Shuriken: Left, Down, Attack1(Z)\n" + "Jab: Attack1(Z)\n" + "Punch: Attack1(Z), Attack1(Z)\n");
    guiNode.attachChild(helpText);
    fireballText = new BitmapText(guiFont);
    fireballText.setColor(ColorRGBA.Orange);
    fireballText.setLocalTranslation(0, fireballText.getLineHeight(), 0);
    guiNode.attachChild(fireballText);
    shurikenText = new BitmapText(guiFont);
    shurikenText.setColor(ColorRGBA.Cyan);
    shurikenText.setLocalTranslation(0, shurikenText.getLineHeight() * 2f, 0);
    guiNode.attachChild(shurikenText);
    jabText = new BitmapText(guiFont);
    jabText.setColor(ColorRGBA.Red);
    jabText.setLocalTranslation(0, jabText.getLineHeight() * 3f, 0);
    guiNode.attachChild(jabText);
    punchText = new BitmapText(guiFont);
    punchText.setColor(ColorRGBA.Green);
    punchText.setLocalTranslation(0, punchText.getLineHeight() * 4f, 0);
    guiNode.attachChild(punchText);
    inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_LEFT));
    inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_RIGHT));
    inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_UP));
    inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_DOWN));
    inputManager.addMapping("Attack1", new KeyTrigger(KeyInput.KEY_Z));
    inputManager.addListener(this, "Left", "Right", "Up", "Down", "Attack1");
    fireball = new ComboMove("Fireball");
    fireball.press("Down").notPress("Right").done();
    fireball.press("Right", "Down").done();
    fireball.press("Right").notPress("Down").done();
    fireball.notPress("Right", "Down").done();
    // no waiting on final state
    fireball.setUseFinalState(false);
    shuriken = new ComboMove("Shuriken");
    shuriken.press("Left").notPress("Down", "Attack1").done();
    shuriken.press("Down").notPress("Attack1").timeElapsed(0.11f).done();
    shuriken.press("Attack1").notPress("Left").timeElapsed(0.11f).done();
    shuriken.notPress("Left", "Down", "Attack1").done();
    jab = new ComboMove("Jab");
    // make jab less important than other moves
    jab.setPriority(0.5f);
    jab.press("Attack1").done();
    punch = new ComboMove("Punch");
    punch.press("Attack1").done();
    punch.notPress("Attack1").done();
    punch.press("Attack1").done();
    fireballExec = new ComboMoveExecution(fireball);
    shurikenExec = new ComboMoveExecution(shuriken);
    jabExec = new ComboMoveExecution(jab);
    punchExec = new ComboMoveExecution(punch);
}
Also used : BitmapText(com.jme3.font.BitmapText) KeyTrigger(com.jme3.input.controls.KeyTrigger)

Example 42 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class ShadowTestUIManager method createText.

private BitmapText createText(BitmapFont guiFont) {
    BitmapText t = new BitmapText(guiFont, false);
    t.setSize(guiFont.getCharSet().getRenderedSize() * 0.75f);
    return t;
}
Also used : BitmapText(com.jme3.font.BitmapText)

Example 43 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TestMultipleApplications method simpleInitApp.

@Override
public void simpleInitApp() {
    clContext = context.getOpenCLContext();
    if (clContext == null) {
        LOG.severe("No OpenCL context found");
        stop();
        return;
    }
    Device device = clContext.getDevices().get(0);
    clQueue = clContext.createQueue(device);
    clQueue.register();
    String source = "" + "__kernel void Fill(__global float* vb, float v)\n" + "{\n" + "  int idx = get_global_id(0);\n" + "  vb[idx] = v;\n" + "}\n";
    Program program = clContext.createProgramFromSourceCode(source);
    program.build();
    program.register();
    kernel = program.createKernel("Fill");
    kernel.register();
    buffer = clContext.createBuffer(4);
    buffer.register();
    flyCam.setEnabled(false);
    inputManager.setCursorVisible(true);
    BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
    infoText = new BitmapText(fnt, false);
    //infoText.setBox(new Rectangle(0, 0, settings.getWidth(), settings.getHeight()));
    infoText.setText("Device: " + clContext.getDevices());
    infoText.setLocalTranslation(0, settings.getHeight(), 0);
    guiNode.attachChild(infoText);
    statusText = new BitmapText(fnt, false);
    //statusText.setBox(new Rectangle(0, 0, settings.getWidth(), settings.getHeight()));
    statusText.setText("Running");
    statusText.setLocalTranslation(0, settings.getHeight() - infoText.getHeight() - 2, 0);
    guiNode.attachChild(statusText);
}
Also used : BitmapText(com.jme3.font.BitmapText) BitmapFont(com.jme3.font.BitmapFont)

Example 44 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TestOpenCLLibraries method simpleInitApp.

@Override
public void simpleInitApp() {
    BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
    Context clContext = context.getOpenCLContext();
    if (clContext == null) {
        BitmapText txt = new BitmapText(fnt);
        txt.setText("No OpenCL Context created!\nSee output log for details.");
        txt.setLocalTranslation(5, settings.getHeight() - 5, 0);
        guiNode.attachChild(txt);
        return;
    }
    CommandQueue clQueue = clContext.createQueue(clContext.getDevices().get(0));
    StringBuilder str = new StringBuilder();
    str.append("OpenCL Context created:\n  Platform: ").append(clContext.getDevices().get(0).getPlatform().getName()).append("\n  Devices: ").append(clContext.getDevices());
    str.append("\nTests:");
    str.append("\n  Random numbers: ").append(testRandom(clContext, clQueue));
    str.append("\n  Matrix3f: ").append(testMatrix3f(clContext, clQueue));
    str.append("\n  Matrix4f: ").append(testMatrix4f(clContext, clQueue));
    clQueue.release();
    BitmapText txt1 = new BitmapText(fnt);
    txt1.setText(str.toString());
    txt1.setLocalTranslation(5, settings.getHeight() - 5, 0);
    guiNode.attachChild(txt1);
    flyCam.setEnabled(false);
    inputManager.setCursorVisible(true);
}
Also used : BitmapText(com.jme3.font.BitmapText) BitmapFont(com.jme3.font.BitmapFont)

Example 45 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TerrainTestModifyHeight method initCrossHairs.

protected void initCrossHairs() {
    BitmapText ch = new BitmapText(guiFont, false);
    ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
    // crosshairs
    ch.setText("+");
    // center
    ch.setLocalTranslation(settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2, settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
    guiNode.attachChild(ch);
}
Also used : BitmapText(com.jme3.font.BitmapText)

Aggregations

BitmapText (com.jme3.font.BitmapText)52 Vector3f (com.jme3.math.Vector3f)10 Geometry (com.jme3.scene.Geometry)9 KeyTrigger (com.jme3.input.controls.KeyTrigger)8 Material (com.jme3.material.Material)8 BitmapFont (com.jme3.font.BitmapFont)7 DirectionalLight (com.jme3.light.DirectionalLight)5 ColorRGBA (com.jme3.math.ColorRGBA)5 Spatial (com.jme3.scene.Spatial)5 Rectangle (com.jme3.font.Rectangle)4 ChaseCamera (com.jme3.input.ChaseCamera)4 Quaternion (com.jme3.math.Quaternion)4 Node (com.jme3.scene.Node)4 Box (com.jme3.scene.shape.Box)4 Quad (com.jme3.scene.shape.Quad)4 ActionListener (com.jme3.input.controls.ActionListener)3 Wire (com.cas.circuit.vo.Wire)2 MotionPath (com.jme3.cinematic.MotionPath)2 MotionPathListener (com.jme3.cinematic.MotionPathListener)2 MotionEvent (com.jme3.cinematic.events.MotionEvent)2