本文整理汇总了Java中com.jme3.font.BitmapText.setText方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapText.setText方法的具体用法?Java BitmapText.setText怎么用?Java BitmapText.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.font.BitmapText
的用法示例。
在下文中一共展示了BitmapText.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
this.app = app;
chunksNode.updateGeometricState();
app.getViewPort().attachScene(chunksNode);
active = true;
new TraceableThread(this::loadChunks, "chunk-loader").start();
new TraceableThread(this::meshChunks, "chunk-mesher").start();
BitmapFont font = app.getAssetManager().loadFont("Interface/Fonts/Console.fnt");
debugText = new BitmapText(font);
debugText.setSize(font.getCharSet().getRenderedSize());
debugText.setColor(ColorRGBA.White);
debugText.setText("");
debugText.setLocalTranslation(0.0f, 0.0f, 1.0f);
debugText.updateGeometricState();
((SimpleApplication)app).getGuiNode().attachChild(debugText);
}
示例2: simpleInitApp
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
@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);
}
示例3: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
BitmapText ch2 = new BitmapText(guiFont, false);
ch2.setSize(guiFont.getCharSet().getRenderedSize());
ch2.setText("Click to select");
ch2.setColor(new ColorRGBA(1f, 0.8f, 0.1f, 1f));
ch2.setLocalTranslation(settings.getWidth() * 0.3f, settings.getHeight() * 0.1f, 0);
guiNode.attachChild(ch2);
}
示例4: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
/** A centred plus sign to help the player aim. */
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize()*1.5f);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
BitmapText ch2 = new BitmapText(guiFont, false);
ch2.setSize(guiFont.getCharSet().getRenderedSize());
ch2.setText("WASD, QE, ZX, RF - Camera Controls");
ch2.setColor(new ColorRGBA(1f,0.8f,0.1f,1f));
ch2.setLocalTranslation(settings.getWidth()*0.3f,settings.getHeight()*0.1f,0);
guiNode.attachChild(ch2);
}
示例5: showBudget
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
private void showBudget()
{
Picture budgetIcon = new Picture("budgetIcon");
budgetIcon.setImage(simpleApp.getAssetManager(), "Interface/budget.png", true);
budgetIcon.setWidth(64);
budgetIcon.setHeight(64);
budgetIcon.move(15, 40, 0);
simpleApp.getGuiNode().attachChild(budgetIcon);
BitmapFont myFont = simpleApp.getAssetManager().loadFont("Interface/Fonts/PoorRichardBig.fnt");
BitmapText budgetText = new BitmapText(myFont);
budgetText.setName("budgetText");
budgetText.setSize(myFont.getCharSet().getRenderedSize());
budgetText.setText(Integer.toString(currentGameState.getBudget()));
budgetText.move(92, 86, 0);
simpleApp.getGuiNode().attachChild(budgetText);
}
示例6: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
示例7: loadHintText
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public void loadHintText() {
hintText = new BitmapText(guiFont, false);
hintText.setSize(guiFont.getCharSet().getRenderedSize());
hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
hintText.setText("Hit T to save, and Y to load");
guiNode.attachChild(hintText);
}
示例8: loadHintText
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public void loadHintText() {
hintText = new BitmapText(guiFont, false);
hintText.setSize(guiFont.getCharSet().getRenderedSize());
hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
//hintText.setText("Hit T to switch to wireframe");
hintText.setText("");
guiNode.attachChild(hintText);
}
示例9: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
protected void initCrossHairs() {
//guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
示例10: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
protected void initCrossHairs() {
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
示例11: loadHintText
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public void loadHintText() {
hintText = new BitmapText(guiFont, false);
hintText.setSize(guiFont.getCharSet().getRenderedSize());
hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
hintText.setText("Hit T to switch to wireframe, P to switch to tri-planar texturing");
guiNode.attachChild(hintText);
}
示例12: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
/** A plus sign used as crosshairs to help the player with aiming.*/
protected void initCrossHairs() {
guiNode.detachAllChildren();
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // fake crosshairs :)
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
示例13: simpleInitApp
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
/** Load a teapot model (OBJ file from test-data) */
Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
Material mat_default = new Material( assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
teapot.setMaterial(mat_default);
rootNode.attachChild(teapot);
/** Create a wall (Box with material and texture from test-data) */
Box box = new Box(Vector3f.ZERO, 2.5f,2.5f,1.0f);
Spatial wall = new Geometry("Box", box );
Material mat_brick = new Material( assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat_brick.setTexture("ColorMap", assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg"));
wall.setMaterial(mat_brick);
wall.setLocalTranslation(2.0f,-2.5f,0.0f);
rootNode.attachChild(wall);
/** Display a line of text (default font from test-data) */
guiNode.detachAllChildren();
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText helloText = new BitmapText(guiFont, false);
helloText.setSize(guiFont.getCharSet().getRenderedSize());
helloText.setText("Hello World");
helloText.setLocalTranslation(300, helloText.getLineHeight(), 0);
guiNode.attachChild(helloText);
/** Load a Ninja model (OgreXML + material + texture from test_data) */
Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");
ninja.scale(0.05f, 0.05f, 0.05f);
ninja.rotate(0.0f, -3.0f, 0.0f);
ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
rootNode.attachChild(ninja);
/** You must add a light to make the model visible */
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f).normalizeLocal());
rootNode.addLight(sun);
}
示例14: initCrossHairs
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
/** A centred plus sign to help the player aim. */
protected void initCrossHairs() {
guiNode.detachAllChildren();
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
ch.setText("+"); // crosshairs
ch.setLocalTranslation( // center
settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2,
settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
示例15: Text
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public Text(String text, ColorRGBA color) {
bitmapText = new BitmapText(UIFactory.getUIConfig().getFont());
bitmapText.setSize(UIFactory.getUIConfig().getBodyFontSize());
bitmapText.setText(text);
if (color != null) {
bitmapText.setColor(color);
}
this.width = bitmapText.getLineWidth();
this.height = bitmapText.getHeight();
attachChild(bitmapText);
setNeedUpdate();
}