Search in sources :

Example 1 with BitmapFont

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

the class BitmapFontLoader method load.

public Object load(AssetInfo info) throws IOException {
    InputStream in = null;
    try {
        in = info.openStream();
        BitmapFont font = load(info.getManager(), info.getKey().getFolder(), in);
        return font;
    } finally {
        if (in != null) {
            in.close();
        }
    }
}
Also used : InputStream(java.io.InputStream) BitmapFont(com.jme3.font.BitmapFont)

Example 2 with BitmapFont

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

the class TestImageRaster method convertAndPutImage.

private void convertAndPutImage(Image image, float posX, float posY) {
    Texture tex = new Texture2D(image);
    tex.setMagFilter(MagFilter.Nearest);
    tex.setMinFilter(MinFilter.NearestNoMipMaps);
    tex.setAnisotropicFilter(16);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", tex);
    Quad q = new Quad(5, 5);
    Geometry g = new Geometry("quad", q);
    g.setLocalTranslation(posX, posY - 5, -0.0001f);
    g.setMaterial(mat);
    rootNode.attachChild(g);
    BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
    BitmapText txt = new BitmapText(fnt);
    txt.setBox(new Rectangle(0, 0, 5, 5));
    txt.setQueueBucket(RenderQueue.Bucket.Transparent);
    txt.setSize(0.5f);
    txt.setText(image.getFormat().name());
    txt.setLocalTranslation(posX, posY, 0);
    rootNode.attachChild(txt);
}
Also used : Geometry(com.jme3.scene.Geometry) Quad(com.jme3.scene.shape.Quad) Texture2D(com.jme3.texture.Texture2D) BitmapText(com.jme3.font.BitmapText) Rectangle(com.jme3.font.Rectangle) Material(com.jme3.material.Material) BitmapFont(com.jme3.font.BitmapFont) Texture(com.jme3.texture.Texture)

Example 3 with BitmapFont

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

the class HelloOpenCL 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();
    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  Buffers: ").append(testBuffer(clContext, clQueue));
    str.append("\n  Kernel: ").append(testKernel(clContext, clQueue));
    str.append("\n  Images: ").append(testImages(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 4 with BitmapFont

use of com.jme3.font.BitmapFont in project TeachingInSimulation by ScOrPiOzzy.

the class ConnectionUtil method getWireTerm.

/**
 * 添加接线头
 * @return 新添加的接线头模型
 */
public static Spatial getWireTerm() {
    AssetManager assetManager = Dispatcher.getIns().getMainApp().getAssetManager();
    Spatial spatial = assetManager.loadModel("Models/JieXianDuanZi.j3o");
    // 创建号码管贴图
    Spatial parent = ((Node) spatial).getChild("Label");
    BitmapFont font = assetManager.loadFont("com/cas/me/fonts/numtext.fnt");
    BitmapText txt1 = getBitmapText(font);
    BitmapText txt2 = getBitmapText(font);
    BitmapText txt3 = getBitmapText(font);
    BitmapText txt4 = getBitmapText(font);
    txt1.setLocalTranslation(new Vector3f(1.3148814f, -1.6f, -1.1656954f));
    txt1.setLocalRotation(new Quaternion(0.8827012f, 0.85739714f, 0.003711f, -0.023661964f));
    txt2.setLocalTranslation(new Vector3f(-1.4674674f, -1.6f, 1.0630512f));
    txt2.setLocalRotation(new Quaternion(-0.0127319945f, -0.0059094937f, -0.8755521f, -0.8649177f));
    txt3.setLocalTranslation(new Vector3f(-1.0670044f, -1.6f, -1.4330314f));
    txt3.setLocalRotation(new Quaternion(-0.60574f, -0.61861926f, 0.6301226f, 0.60679734f));
    txt4.setLocalTranslation(new Vector3f(1.0652375f, -1.6f, 1.4834414f));
    txt4.setLocalRotation(new Quaternion(0.6125322f, 0.62533164f, 0.608011f, 0.6155914f));
    ((Node) parent).attachChild(txt1);
    ((Node) parent).attachChild(txt2);
    ((Node) parent).attachChild(txt3);
    ((Node) parent).attachChild(txt4);
    // spatial.setLocalScale(0.001f);
    return spatial;
}
Also used : AssetManager(com.jme3.asset.AssetManager) BitmapText(com.jme3.font.BitmapText) Spatial(com.jme3.scene.Spatial) Quaternion(com.jme3.math.Quaternion) Node(com.jme3.scene.Node) Vector3f(com.jme3.math.Vector3f) BitmapFont(com.jme3.font.BitmapFont)

Example 5 with BitmapFont

use of com.jme3.font.BitmapFont in project TeachingInSimulation by ScOrPiOzzy.

the class ConnectionUtil method getBitmapText.

private static BitmapText getBitmapText(BitmapFont font) {
    final BitmapText bitmapText = new BitmapText(font);
    bitmapText.setQueueBucket(Bucket.Transparent);
    bitmapText.setLocalScale(0.048106655f);
    bitmapText.setColor(ColorRGBA.Black);
    bitmapText.setName("Text");
    return bitmapText;
}
Also used : BitmapText(com.jme3.font.BitmapText)

Aggregations

BitmapText (com.jme3.font.BitmapText)10 BitmapFont (com.jme3.font.BitmapFont)9 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 AssetManager (com.jme3.asset.AssetManager)1 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 Quaternion (com.jme3.math.Quaternion)1 Vector3f (com.jme3.math.Vector3f)1 Node (com.jme3.scene.Node)1 Spatial (com.jme3.scene.Spatial)1 Texture2D (com.jme3.texture.Texture2D)1 BufferedReader (java.io.BufferedReader)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1