Search in sources :

Example 31 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TestResizableApp method simpleInitApp.

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);
}
Also used : Geometry(com.jme3.scene.Geometry) BitmapText(com.jme3.font.BitmapText) TestBox(jme3test.model.shape.TestBox) Box(com.jme3.scene.shape.Box) Material(com.jme3.material.Material)

Example 32 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class CubeField method simpleInitApp.

/**
     * 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();
}
Also used : Geometry(com.jme3.scene.Geometry) BitmapText(com.jme3.font.BitmapText) ColorRGBA(com.jme3.math.ColorRGBA)

Example 33 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TestBitmapFont method simpleInitApp.

@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);
}
Also used : BitmapText(com.jme3.font.BitmapText) KeyTrigger(com.jme3.input.controls.KeyTrigger) Rectangle(com.jme3.font.Rectangle) BitmapFont(com.jme3.font.BitmapFont)

Example 34 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class TestBitmapText3D method simpleInitApp.

@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);
}
Also used : Geometry(com.jme3.scene.Geometry) Quad(com.jme3.scene.shape.Quad) BitmapText(com.jme3.font.BitmapText) Rectangle(com.jme3.font.Rectangle) BitmapFont(com.jme3.font.BitmapFont)

Example 35 with BitmapText

use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.

the class HelloAssets method simpleInitApp.

@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(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) */
    setDisplayStatView(false);
    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);
}
Also used : Geometry(com.jme3.scene.Geometry) BitmapText(com.jme3.font.BitmapText) Spatial(com.jme3.scene.Spatial) DirectionalLight(com.jme3.light.DirectionalLight) Vector3f(com.jme3.math.Vector3f) Material(com.jme3.material.Material) Box(com.jme3.scene.shape.Box)

Aggregations

BitmapText (com.jme3.font.BitmapText)52 Vector3f (com.jme3.math.Vector3f)10 Geometry (com.jme3.scene.Geometry)9 KeyTrigger (com.jme3.input.controls.KeyTrigger)8 Material (com.jme3.material.Material)8 BitmapFont (com.jme3.font.BitmapFont)7 DirectionalLight (com.jme3.light.DirectionalLight)5 ColorRGBA (com.jme3.math.ColorRGBA)5 Spatial (com.jme3.scene.Spatial)5 Rectangle (com.jme3.font.Rectangle)4 ChaseCamera (com.jme3.input.ChaseCamera)4 Quaternion (com.jme3.math.Quaternion)4 Node (com.jme3.scene.Node)4 Box (com.jme3.scene.shape.Box)4 Quad (com.jme3.scene.shape.Quad)4 ActionListener (com.jme3.input.controls.ActionListener)3 Wire (com.cas.circuit.vo.Wire)2 MotionPath (com.jme3.cinematic.MotionPath)2 MotionPathListener (com.jme3.cinematic.MotionPathListener)2 MotionEvent (com.jme3.cinematic.events.MotionEvent)2