com.jme3.font.BitmapText Java Examples
The following examples show how to use
com.jme3.font.BitmapText.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CubeField.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Initializes game */ @Override public void simpleInitApp() { Logger.getLogger("com.jme3").setLevel(Level.WARNING); flyCam.setEnabled(false); setDisplayStatView(false); 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(); }
Example #2
Source File: DetailedProfilerState.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public boolean setColor(BitmapText t, double value, double totalTime, boolean isParent, boolean expended) { boolean dimmed = isParent && expended; boolean insignificant = false; if (value > 1000000000.0 / 30.0) { t.setColor(dimmed ? dimmedRed : ColorRGBA.Red); } else if (value > 1000000000.0 / 60.0) { t.setColor(dimmed ? dimmedOrange : ColorRGBA.Orange); } else if (value > totalTime / 3) { t.setColor(dimmed ? dimmedGreen : ColorRGBA.Green); } else if (value < 30000) { t.setColor(ColorRGBA.DarkGray); insignificant = true; } else { t.setColor(dimmed ? dimmedWhite : ColorRGBA.White); } return insignificant; }
Example #3
Source File: StatsView.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
public StatsView(String name, AssetManager manager, Statistics stats){ super(name); setQueueBucket(Bucket.Gui); setCullHint(CullHint.Never); statistics = stats; statistics.setEnabled(enabled); statLabels = statistics.getLabels(); statData = new int[statLabels.length]; BitmapFont font = manager.loadFont("Interface/Fonts/Console.fnt"); statText = new BitmapText(font); statText.setLocalTranslation(0, statText.getLineHeight() * statLabels.length, 0); attachChild(statText); addControl(this); }
Example #4
Source File: TestObjGroupsLoading.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { // load scene with following structure: // Chair 1 (just mesh without name) and named groups: Chair 2, Pillow 2, Podium Spatial scene = assetManager.loadModel(new ModelKey("OBJLoaderTest/TwoChairs.obj")); // add light to make it visible scene.addLight(new AmbientLight(ColorRGBA.White)); // attach scene to the root rootNode.attachChild(scene); // configure camera for best scene viewing cam.setLocation(new Vector3f(-3, 4, 3)); cam.lookAtDirection(new Vector3f(0, -0.5f, -1), Vector3f.UNIT_Y); flyCam.setMoveSpeed(10); // create display to indicate pointed geometry name pointerDisplay = new BitmapText(guiFont); pointerDisplay.setBox(new Rectangle(0, settings.getHeight(), settings.getWidth(), settings.getHeight()/2)); pointerDisplay.setAlignment(BitmapFont.Align.Center); pointerDisplay.setVerticalAlignment(BitmapFont.VAlign.Center); guiNode.attachChild(pointerDisplay); initCrossHairs(); }
Example #5
Source File: TestImageRaster.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void convertAndPutImage(Image image, float posX, float posY) { Texture tex = new Texture2D(image); tex.setMagFilter(MagFilter.Nearest); tex.setMinFilter(MinFilter.NearestNoMipMaps); tex.setAnisotropicFilter(16); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", tex); Quad q = new Quad(5, 5); Geometry g = new Geometry("quad", q); g.setLocalTranslation(posX, posY - 5, -0.0001f); g.setMaterial(mat); rootNode.attachChild(g); BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); BitmapText txt = new BitmapText(fnt); txt.setBox(new Rectangle(0, 0, 5, 5)); txt.setQueueBucket(RenderQueue.Bucket.Transparent); txt.setSize(0.5f); txt.setText(image.getFormat().name()); txt.setLocalTranslation(posX, posY, 0); rootNode.attachChild(txt); }
Example #6
Source File: CubeField.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** * 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(); }
Example #7
Source File: TestBitmapText3D.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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); }
Example #8
Source File: JmeBitmapText.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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; }
Example #9
Source File: TestBitmapFont.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); }
Example #10
Source File: TestResizableApp.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { flyCam.setDragToRotate(true); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); geom.setMaterial(mat); rootNode.attachChild(geom); txt = new BitmapText(loadGuiFont(), false); txt.setText("Drag the corners of the application to resize it.\n" + "Current Size: " + settings.getWidth() + "x" + settings.getHeight()); txt.setLocalTranslation(0, settings.getHeight(), 0); guiNode.attachChild(txt); }
Example #11
Source File: TestBitmapText3D.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@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); }
Example #12
Source File: TerrainTestModifyHeight.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example #13
Source File: TestOpenCLLibraries.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); Context clContext = context.getOpenCLContext(); if (clContext == null) { BitmapText txt = new BitmapText(fnt); txt.setText("No OpenCL Context created!\nSee output log for details."); txt.setLocalTranslation(5, settings.getHeight() - 5, 0); guiNode.attachChild(txt); return; } CommandQueue clQueue = clContext.createQueue(clContext.getDevices().get(0)); StringBuilder str = new StringBuilder(); str.append("OpenCL Context created:\n Platform: ") .append(clContext.getDevices().get(0).getPlatform().getName()) .append("\n Devices: ").append(clContext.getDevices()); str.append("\nTests:"); str.append("\n Random numbers: ").append(testRandom(clContext, clQueue)); str.append("\n Matrix3f: ").append(testMatrix3f(clContext, clQueue)); str.append("\n Matrix4f: ").append(testMatrix4f(clContext, clQueue)); clQueue.release(); BitmapText txt1 = new BitmapText(fnt); txt1.setText(str.toString()); txt1.setLocalTranslation(5, settings.getHeight() - 5, 0); guiNode.attachChild(txt1); flyCam.setEnabled(false); inputManager.setCursorVisible(true); }
Example #14
Source File: AndroidApplication.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * 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); }
Example #15
Source File: RenderDeviceJme.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY) { if (str.length() == 0) return; if (font instanceof RenderFontNull) return; RenderFontJme jmeFont = (RenderFontJme) font; String key = font+str+color.getColorString(); BitmapText text = textCacheLastFrame.get(key); if (text == null) { text = jmeFont.createText(); text.setText(str); text.updateLogicalState(0); } textCacheCurrentFrame.put(key, text); niftyMat.setColor("Color", convertColor(color, tempColor)); niftyMat.setBoolean("UseTex", true); niftyMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha); // niftyMat.getAdditionalRenderState().setBlendMode(convertBlend()); text.setMaterial(niftyMat); float width = text.getLineWidth(); float height = text.getLineHeight(); float x0 = x + 0.5f * width * (1f - sizeX); float y0 = y + 0.5f * height * (1f - sizeY); tempMat.loadIdentity(); tempMat.setTranslation(x0, getHeight() - y0, 0); tempMat.setScale(sizeX, sizeY, 0); rm.setWorldMatrix(tempMat); text.render(rm); // System.out.println("renderFont"); }
Example #16
Source File: RenderDeviceJme.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void endFrame() { HashMap<String, BitmapText> temp = textCacheLastFrame; textCacheLastFrame = textCacheCurrentFrame; textCacheCurrentFrame = temp; textCacheCurrentFrame.clear(); // System.exit(1); }
Example #17
Source File: TerrainTest.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example #18
Source File: TestBrickWall.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example #19
Source File: TestBrickTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example #20
Source File: HelloPhysics.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** 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); }
Example #21
Source File: HelloAssets.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@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); }
Example #22
Source File: HelloPicking.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** 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); }
Example #23
Source File: TestBitmapFontLayout.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected void setupInstructionsNote() { // Add some instructional text String instructions = "WASD/Cursor Keys = scroll\n" + "+/- = zoom\n" + "space = reset view\n" + "0 = reset zoom\n"; BitmapText note = new BitmapText(guiFont); note.setText(instructions); note.setColor(new ColorRGBA(0, 0.3f, 0, 1)); note.updateLogicalState(0.1f); BoundingBox bb = (BoundingBox)note.getWorldBound(); note.setLocalTranslation(cam.getWidth() - bb.getXExtent() * 2 - 20, cam.getHeight() - 20, 10); guiNode.attachChild(note); BitmapText note2 = note.clone(); note2.setColor(ColorRGBA.Black); note2.move(1, -1, -2); guiNode.attachChild(note2); BitmapText note3 = note.clone(); note3.setColor(ColorRGBA.White); note3.move(-1, 1, -1); guiNode.attachChild(note3); }
Example #24
Source File: RenderFontJme.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Initialize the font. * @param name font filename */ public RenderFontJme(String name, NiftyJmeDisplay display) { this.display = display; font = display.getAssetManager().loadFont(name); if (font == null) { throw new RuntimeException( "Font not loaded:" + name ); } text = new BitmapText(font); actualSize = font.getPreferredSize(); text.setSize(actualSize); }
Example #25
Source File: HelloOpenCL.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); Context clContext = context.getOpenCLContext(); if (clContext == null) { BitmapText txt = new BitmapText(fnt); txt.setText("No OpenCL Context created!\nSee output log for details."); txt.setLocalTranslation(5, settings.getHeight() - 5, 0); guiNode.attachChild(txt); return; } CommandQueue clQueue = clContext.createQueue(); StringBuilder str = new StringBuilder(); str.append("OpenCL Context created:\n Platform: ") .append(clContext.getDevices().get(0).getPlatform().getName()) .append("\n Devices: ").append(clContext.getDevices()); str.append("\nTests:"); str.append("\n Buffers: ").append(testBuffer(clContext, clQueue)); str.append("\n Kernel: ").append(testKernel(clContext, clQueue)); str.append("\n Images: ").append(testImages(clContext, clQueue)); clQueue.release(); BitmapText txt1 = new BitmapText(fnt); txt1.setText(str.toString()); txt1.setLocalTranslation(5, settings.getHeight() - 5, 0); guiNode.attachChild(txt1); flyCam.setEnabled(false); inputManager.setCursorVisible(true); }
Example #26
Source File: TestBatchNodeTower.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
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); }
Example #27
Source File: RenderFontJme.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Initialize the font. * @param name font filename * @param display */ public RenderFontJme(String name, NiftyJmeDisplay display) { font = display.getAssetManager().loadFont(name); text = new BitmapText(font); actualSize = font.getPreferredSize(); text.setSize(actualSize); }
Example #28
Source File: TestBatchNodeTower.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }
Example #29
Source File: TestRtlBitmapText.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt"); // A right to left BitmapText BitmapText txt = new BitmapText(fnt, true); txt.setBox(new Rectangle(0, 0, 150, 0)); txt.setLineWrapMode(LineWrapMode.Word); txt.setAlignment(BitmapFont.Align.Right); txt.setText(text); txt.setLocalTranslation(cam.getWidth() / 2, cam.getHeight() / 2, 0); guiNode.attachChild(txt); }
Example #30
Source File: TestBoneRagdoll.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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); }