当前位置: 首页>>代码示例>>Java>>正文


Java BitmapText.setLocalTranslation方法代码示例

本文整理汇总了Java中com.jme3.font.BitmapText.setLocalTranslation方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapText.setLocalTranslation方法的具体用法?Java BitmapText.setLocalTranslation怎么用?Java BitmapText.setLocalTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.font.BitmapText的用法示例。


在下文中一共展示了BitmapText.setLocalTranslation方法的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);
}
 
开发者ID:quadracoatl,项目名称:quadracoatl,代码行数:27,代码来源:ChunkManagingState.java

示例2: 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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:TestBitmapFont.java

示例3: 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);
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:21,代码来源:LabelAppState.java

示例4: 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);
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:cubes,代码行数:24,代码来源:TestPicking.java

示例5: 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);        
  
  
}
 
开发者ID:mifth,项目名称:JME-Simple-Examples,代码行数:22,代码来源:RtsCamera.java

示例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);
}
 
开发者ID:jvpichowski,项目名称:ZayES-Bullet,代码行数:11,代码来源:ForceFieldExample.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:TerrainTestReadWrite.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:TerrainTestCollision.java

示例9: loadFPSText

import com.jme3.font.BitmapText; //导入方法依赖的package包/类
/**
 * Attaches FPS statistics to guiNode and displays it on the screen.
 *
 */
public void loadFPSText() {
    guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    fpsText = new BitmapText(guiFont, false);
    fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);
    fpsText.setText("Frames per second");
    guiNode.attachChild(fpsText);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:SimpleApplication.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:TerrainTestModifyHeight.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:8,代码来源:TerrainTest.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:HelloPhysics.java

示例13: 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);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:10,代码来源:SceneApplication.java

示例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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:HelloPicking.java

示例15: 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);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:TestLightScattering.java


注:本文中的com.jme3.font.BitmapText.setLocalTranslation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。