Search in sources :

Example 6 with BitmapFont

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

the class TestBitmapFont method simpleInitApp.

@Override
public void simpleInitApp() {
    inputManager.addMapping("WordWrap", new KeyTrigger(KeyInput.KEY_TAB));
    inputManager.addListener(keyListener, "WordWrap");
    inputManager.addRawInputListener(textListener);
    BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
    txt = new BitmapText(fnt, false);
    txt.setBox(new Rectangle(0, 0, settings.getWidth(), settings.getHeight()));
    txt.setSize(fnt.getPreferredSize() * 2f);
    txt.setText(txtB);
    txt.setLocalTranslation(0, txt.getHeight(), 0);
    guiNode.attachChild(txt);
    txt2 = new BitmapText(fnt, false);
    txt2.setSize(fnt.getPreferredSize() * 1.2f);
    txt2.setText("Text without restriction. \nText without restriction. Text without restriction. Text without restriction");
    txt2.setLocalTranslation(0, txt2.getHeight(), 0);
    guiNode.attachChild(txt2);
    txt3 = new BitmapText(fnt, false);
    txt3.setBox(new Rectangle(0, 0, settings.getWidth(), 0));
    txt3.setText("Press Tab to toggle word-wrap. type text and enter to input text");
    txt3.setLocalTranslation(0, settings.getHeight() / 2, 0);
    guiNode.attachChild(txt3);
}
Also used : BitmapText(com.jme3.font.BitmapText) KeyTrigger(com.jme3.input.controls.KeyTrigger) Rectangle(com.jme3.font.Rectangle) BitmapFont(com.jme3.font.BitmapFont)

Example 7 with BitmapFont

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

the class TestBitmapText3D method simpleInitApp.

@Override
public void simpleInitApp() {
    Quad q = new Quad(6, 3);
    Geometry g = new Geometry("quad", q);
    g.setLocalTranslation(0, -3, -0.0001f);
    g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
    rootNode.attachChild(g);
    BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
    BitmapText txt = new BitmapText(fnt, false);
    txt.setBox(new Rectangle(0, 0, 6, 3));
    txt.setQueueBucket(Bucket.Transparent);
    txt.setSize(0.5f);
    txt.setText(txtB);
    rootNode.attachChild(txt);
}
Also used : Geometry(com.jme3.scene.Geometry) Quad(com.jme3.scene.shape.Quad) BitmapText(com.jme3.font.BitmapText) Rectangle(com.jme3.font.Rectangle) BitmapFont(com.jme3.font.BitmapFont)

Example 8 with BitmapFont

use of com.jme3.font.BitmapFont 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 9 with BitmapFont

use of com.jme3.font.BitmapFont 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 10 with BitmapFont

use of com.jme3.font.BitmapFont 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)

Aggregations

BitmapFont (com.jme3.font.BitmapFont)8 BitmapText (com.jme3.font.BitmapText)8 Rectangle (com.jme3.font.Rectangle)3 Material (com.jme3.material.Material)2 Geometry (com.jme3.scene.Geometry)2 Quad (com.jme3.scene.shape.Quad)2 Texture (com.jme3.texture.Texture)2 BitmapCharacter (com.jme3.font.BitmapCharacter)1 BitmapCharacterSet (com.jme3.font.BitmapCharacterSet)1 KeyTrigger (com.jme3.input.controls.KeyTrigger)1 MaterialDef (com.jme3.material.MaterialDef)1 Texture2D (com.jme3.texture.Texture2D)1 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1