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();
}
}
}
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);
}
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);
}
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;
}
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;
}
Aggregations