本文整理汇总了Java中com.jme3.font.BitmapText类的典型用法代码示例。如果您正苦于以下问题:Java BitmapText类的具体用法?Java BitmapText怎么用?Java BitmapText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BitmapText类属于com.jme3.font包,在下文中一共展示了BitmapText类的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: initialize
import com.jme3.font.BitmapText; //导入依赖的package包/类
public void initialize( PhetJMEApplication application, Node containerNode ) {
this.application = application;
// load FPS
guiFont = application.getAssetManager().loadFont( "Interface/Fonts/Default.fnt" );
fpsText = new BitmapText( guiFont, false );
fpsText.setLocalTranslation( 0, fpsText.getLineHeight(), 0 );
fpsText.setText( "Frames per second" );
containerNode.attachChild( fpsText );
// load stats
statsView = new StatsView( "Statistics View", application.getAssetManager(), application.getRenderer().getStatistics() );
statsView.setLocalTranslation( 0, fpsText.getLineHeight(), 0 ); // move it up so it appears above fps text
containerNode.attachChild( statsView );
// defaults
setDisplayFps( false );
setDisplayStatView( false );
// update on each frame
application.addUpdateObserver( new SimpleObserver() {
public void update() {
updateView();
}
} );
}
示例3: 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);
}
示例4: 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);
}
示例5: simpleInitApp
import com.jme3.font.BitmapText; //导入依赖的package包/类
/**
* Initializes game
*/
@Override
public void simpleInitApp() {
Logger.getLogger("com.jme3").setLevel(Level.WARNING);
flyCam.setEnabled(false);
statsView.setCullHint(CullHint.Always);
Keys();
defaultFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
pressStart = new BitmapText(defaultFont, false);
fpsScoreText = new BitmapText(defaultFont, false);
loadText(fpsScoreText, "Current Score: 0", defaultFont, 0, 2, 0);
loadText(pressStart, "PRESS ENTER", defaultFont, 0, 5, 0);
player = createPlayer();
rootNode.attachChild(player);
cubeField = new ArrayList<Geometry>();
obstacleColors = new ArrayList<ColorRGBA>();
gameReset();
}
示例6: StatsView
import com.jme3.font.BitmapText; //导入依赖的package包/类
public StatsView(String name, AssetManager manager, Statistics stats){
super(name);
setQueueBucket(Bucket.Gui);
setCullHint(CullHint.Never);
statistics = stats;
statLabels = statistics.getLabels();
statData = new int[statLabels.length];
labels = new BitmapText[statLabels.length];
BitmapFont font = manager.loadFont("Interface/Fonts/Console.fnt");
for (int i = 0; i < labels.length; i++){
labels[i] = new BitmapText(font);
labels[i].setLocalTranslation(0, labels[i].getLineHeight() * (i+1), 0);
attachChild(labels[i]);
}
addControl(this);
}
示例7: createSheet
import com.jme3.font.BitmapText; //导入依赖的package包/类
@Override
protected Sheet createSheet() {
//TODO: multithreading..
Sheet sheet = super.createSheet();
Sheet.Set set = Sheet.createPropertiesSet();
set.setDisplayName("BitmapText");
set.setName(BitmapText.class.getName());
BitmapText obj = geom;//getLookup().lookup(Spatial.class);
if (obj == null) {
return sheet;
}
set.put(makeProperty(obj, String.class, "getText", "setText", "Text"));
set.put(makeProperty(obj, ColorRGBA.class, "getColor", "setColor", "Color"));
set.put(makeProperty(obj, BitmapFont.class, "getFont", "Font"));
sheet.put(set);
return sheet;
}
示例8: updateLabel
import com.jme3.font.BitmapText; //导入依赖的package包/类
public void updateLabel(Node object) {
BitmapText label = labels.get(object);
float distance = cam.getLocation().distance(object.getWorldTranslation());
float fontSize = distance * labelScale.z;// distance * scale
fontSize = (fontSize < labelScale.x) ? labelScale.x : fontSize;// check if under minimum
fontSize = (fontSize > labelScale.y) ? labelScale.y : fontSize;// check if over maximum
label.setSize(fontSize);
// update offset with font size
offset.set(offset.x, fontSize, offset.z);
Vector3f scr = cam.getScreenCoordinates(object.getWorldTranslation());
scr.addLocal(offset);
scr.subtractLocal(label.getLineWidth() / 2,
label.getLineHeight() / 2, 0);
label.setLocalTranslation(scr);
}
示例9: initGUI
import com.jme3.font.BitmapText; //导入依赖的package包/类
private void initGUI(){
//Crosshair
BitmapText crosshair = new BitmapText(guiFont);
crosshair.setText("+");
crosshair.setSize(guiFont.getCharSet().getRenderedSize() * 2);
crosshair.setLocalTranslation(
(settings.getWidth() / 2) - (guiFont.getCharSet().getRenderedSize() / 3 * 2),
(settings.getHeight() / 2) + (crosshair.getLineHeight() / 2), 0);
guiNode.attachChild(crosshair);
//Instructions
BitmapText instructionsText1 = new BitmapText(guiFont);
instructionsText1.setText("Left Click: Set");
instructionsText1.setLocalTranslation(0, settings.getHeight(), 0);
guiNode.attachChild(instructionsText1);
BitmapText instructionsText2 = new BitmapText(guiFont);
instructionsText2.setText("Right Click: Remove");
instructionsText2.setLocalTranslation(0, settings.getHeight() - instructionsText2.getLineHeight(), 0);
guiNode.attachChild(instructionsText2);
BitmapText instructionsText3 = new BitmapText(guiFont);
instructionsText3.setText("(Bottom layer is marked as indestructible)");
instructionsText3.setLocalTranslation(0, settings.getHeight() - (2 * instructionsText3.getLineHeight()), 0);
guiNode.attachChild(instructionsText3);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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));
}
示例13: 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);
}
示例14: 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);
}
示例15: 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);
}