本文整理汇总了Java中com.jme3.font.BitmapText.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapText.setSize方法的具体用法?Java BitmapText.setSize怎么用?Java BitmapText.setSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.font.BitmapText
的用法示例。
在下文中一共展示了BitmapText.setSize方法的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: AimingControl
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public AimingControl(SimpleApplication app, Node player) {
this.app = app;
asm = this.app.getAssetManager();
cam = app.getCamera();
this.player = player;
list = new LinkedList<Spatial>();
timer = 0f;
centerCam = new Vector2f(cam.getWidth() / 2, cam.getHeight() / 2);
distanceToRemove = 300f;
BitmapFont guiFont = asm.loadFont("Interface/Fonts/Default.fnt");
ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize());
ch.setColor(new ColorRGBA(1f, 0.35f, 0.1f, 0.8f));
}
示例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: simpleInitApp
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
@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);
}
示例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: onEntityAdded
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
@Override
protected void onEntityAdded(Entity e) {
FloatingLabel label = e.get(FloatingLabel.class);
BitmapText bt = new BitmapText(font);
bt.setText(label.getLabel());
bt.setColor(TranslateUtil.toColorRGBA(label.getColor()));
bt.setSize((float)label.getSize());
//bt.addControl(new BillboardControl());
bitmaps.put(e.getId(), bt);
//AppFacade.getMainSceneNode().attachChild(bt);
RendererPlatform.getApp().getGuiNode().attachChild(bt);
onEntityUpdated(e);
}
示例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: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: loadFPSText
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public void loadFPSText(){
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
fpsText = new BitmapText(guiFont, false);
fpsText.setSize(guiFont.getCharSet().getRenderedSize());
fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);
fpsText.setText("Frames per second");
guiNode.attachChild(fpsText);
}
示例14: addLineAndText
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
private void addLineAndText() {
line = new Geometry("line", new Line(Vector3f.ZERO, Vector3f.ZERO));
Material m = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
m.setColor("Color", ColorRGBA.White);
line.setMaterial(m);
angleText = new BitmapText(manager.loadFont("Interface/Fonts/Default.fnt"));
BillboardControl control = new BillboardControl();
angleText.addControl(control);
angleText.setSize(0.5f);
angleText.setCullHint(Spatial.CullHint.Never);
}
示例15: loadFPSText
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
private void loadFPSText() {
BitmapFont font = assetManager.loadFont("Interface/Fonts/Default.fnt");
fpsText = new BitmapText(font, false);
fpsText.setSize(font.getCharSet().getRenderedSize());
fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);
fpsText.setText("Frames per second");
statsGuiNode.attachChild(fpsText);
}