use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class DetailedProfilerState method initialize.
@Override
protected void initialize(Application app) {
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(0, 0, 0, 0.5f));
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
Geometry darkenStats = new Geometry("StatsDarken", new Quad(PANEL_WIDTH, app.getCamera().getHeight()));
darkenStats.setMaterial(mat);
darkenStats.setLocalTranslation(0, -app.getCamera().getHeight(), -1);
ui.attachChild(darkenStats);
ui.setLocalTranslation(app.getCamera().getWidth() - PANEL_WIDTH, app.getCamera().getHeight(), 0);
font = app.getAssetManager().loadFont("Interface/Fonts/Console.fnt");
bigFont = app.getAssetManager().loadFont("Interface/Fonts/Default.fnt");
prof.setRenderer(app.getRenderer());
rootLine = new StatLineView("Frame");
rootLine.attachTo(ui);
BitmapText frameLabel = new BitmapText(bigFont);
frameLabel.setText("Total Frame Time: ");
ui.attachChild(frameLabel);
frameLabel.setLocalTranslation(new Vector3f(PANEL_WIDTH / 2 - bigFont.getLineWidth(frameLabel.getText()), -PADDING, 0));
BitmapText cpuLabel = new BitmapText(bigFont);
cpuLabel.setText("CPU");
ui.attachChild(cpuLabel);
cpuLabel.setLocalTranslation(PANEL_WIDTH / 4 - bigFont.getLineWidth(cpuLabel.getText()) / 2, -PADDING - 30, 0);
BitmapText gpuLabel = new BitmapText(bigFont);
gpuLabel.setText("GPU");
ui.attachChild(gpuLabel);
gpuLabel.setLocalTranslation(3 * PANEL_WIDTH / 4 - bigFont.getLineWidth(gpuLabel.getText()) / 2, -PADDING - 30, 0);
frameTimeValue = new BitmapText(bigFont);
frameCpuTimeValue = new BitmapText(bigFont);
frameGpuTimeValue = new BitmapText(bigFont);
selectedField = new BitmapText(font);
selectedField.setText("Selected: ");
selectedField.setLocalTranslation(PANEL_WIDTH / 2, -PADDING - 75, 0);
selectedField.setColor(ColorRGBA.Yellow);
ui.attachChild(frameTimeValue);
ui.attachChild(frameCpuTimeValue);
ui.attachChild(frameGpuTimeValue);
ui.attachChild(selectedField);
hideInsignificantField = new BitmapText(font);
hideInsignificantField.setText("O " + INSIGNIFICANT);
hideInsignificantField.setLocalTranslation(PADDING, -PADDING - 75, 0);
ui.attachChild(hideInsignificantField);
final InputManager inputManager = app.getInputManager();
if (inputManager != null) {
inputManager.addMapping(TOGGLE_KEY, new KeyTrigger(KeyInput.KEY_F6));
inputManager.addMapping(CLICK_KEY, new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(new ActionListener() {
@Override
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals(TOGGLE_KEY) && isPressed) {
setEnabled(!isEnabled());
}
if (isEnabled() && name.equals(CLICK_KEY) && isPressed) {
handleClick(inputManager.getCursorPosition());
}
}
}, TOGGLE_KEY, CLICK_KEY);
}
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class StatsAppState method loadFpsText.
/**
* Attaches FPS statistics to guiNode and displays it on the screen.
*
*/
public void loadFpsText() {
if (fpsText == null) {
fpsText = new BitmapText(guiFont, false);
}
fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0);
fpsText.setText("Frames per second");
fpsText.setCullHint(showFps ? CullHint.Never : CullHint.Always);
guiNode.attachChild(fpsText);
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class TestBrickWall method initCrossHairs.
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
// crosshairs
ch.setText("+");
// center
ch.setLocalTranslation(settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2, settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class TestBoneRagdoll method initCrossHairs.
protected void initCrossHairs() {
guiFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText ch = new BitmapText(guiFont, false);
ch.setSize(guiFont.getCharSet().getRenderedSize() * 2);
// crosshairs
ch.setText("+");
// center
ch.setLocalTranslation(settings.getWidth() / 2 - guiFont.getCharSet().getRenderedSize() / 3 * 2, settings.getHeight() / 2 + ch.getLineHeight() / 2, 0);
guiNode.attachChild(ch);
}
use of com.jme3.font.BitmapText in project TeachingInSimulation by ScOrPiOzzy.
the class WireNumberControl method controlUpdate.
@Override
protected void controlUpdate(float tpf) {
for (Entry<BitmapText, Vector3f> num : nums.entrySet()) {
Vector3f middle = num.getValue();
Vector3f loc = camera.getScreenCoordinates(middle);
moveMarker(num.getKey(), loc);
}
}
Aggregations