use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class TestComboMoves method simpleInitApp.
@Override
public void simpleInitApp() {
setDisplayFps(false);
setDisplayStatView(false);
// Create debug text
BitmapText helpText = new BitmapText(guiFont);
helpText.setLocalTranslation(0, settings.getHeight(), 0);
helpText.setText("Moves:\n" + "Fireball: Down, Down+Right, Right\n" + "Shuriken: Left, Down, Attack1(Z)\n" + "Jab: Attack1(Z)\n" + "Punch: Attack1(Z), Attack1(Z)\n");
guiNode.attachChild(helpText);
fireballText = new BitmapText(guiFont);
fireballText.setColor(ColorRGBA.Orange);
fireballText.setLocalTranslation(0, fireballText.getLineHeight(), 0);
guiNode.attachChild(fireballText);
shurikenText = new BitmapText(guiFont);
shurikenText.setColor(ColorRGBA.Cyan);
shurikenText.setLocalTranslation(0, shurikenText.getLineHeight() * 2f, 0);
guiNode.attachChild(shurikenText);
jabText = new BitmapText(guiFont);
jabText.setColor(ColorRGBA.Red);
jabText.setLocalTranslation(0, jabText.getLineHeight() * 3f, 0);
guiNode.attachChild(jabText);
punchText = new BitmapText(guiFont);
punchText.setColor(ColorRGBA.Green);
punchText.setLocalTranslation(0, punchText.getLineHeight() * 4f, 0);
guiNode.attachChild(punchText);
inputManager.addMapping("Left", new KeyTrigger(KeyInput.KEY_LEFT));
inputManager.addMapping("Right", new KeyTrigger(KeyInput.KEY_RIGHT));
inputManager.addMapping("Up", new KeyTrigger(KeyInput.KEY_UP));
inputManager.addMapping("Down", new KeyTrigger(KeyInput.KEY_DOWN));
inputManager.addMapping("Attack1", new KeyTrigger(KeyInput.KEY_Z));
inputManager.addListener(this, "Left", "Right", "Up", "Down", "Attack1");
fireball = new ComboMove("Fireball");
fireball.press("Down").notPress("Right").done();
fireball.press("Right", "Down").done();
fireball.press("Right").notPress("Down").done();
fireball.notPress("Right", "Down").done();
// no waiting on final state
fireball.setUseFinalState(false);
shuriken = new ComboMove("Shuriken");
shuriken.press("Left").notPress("Down", "Attack1").done();
shuriken.press("Down").notPress("Attack1").timeElapsed(0.11f).done();
shuriken.press("Attack1").notPress("Left").timeElapsed(0.11f).done();
shuriken.notPress("Left", "Down", "Attack1").done();
jab = new ComboMove("Jab");
// make jab less important than other moves
jab.setPriority(0.5f);
jab.press("Attack1").done();
punch = new ComboMove("Punch");
punch.press("Attack1").done();
punch.notPress("Attack1").done();
punch.press("Attack1").done();
fireballExec = new ComboMoveExecution(fireball);
shurikenExec = new ComboMoveExecution(shuriken);
jabExec = new ComboMoveExecution(jab);
punchExec = new ComboMoveExecution(punch);
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class ShadowTestUIManager method createText.
private BitmapText createText(BitmapFont guiFont) {
BitmapText t = new BitmapText(guiFont, false);
t.setSize(guiFont.getCharSet().getRenderedSize() * 0.75f);
return t;
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class TestMultipleApplications method simpleInitApp.
@Override
public void simpleInitApp() {
clContext = context.getOpenCLContext();
if (clContext == null) {
LOG.severe("No OpenCL context found");
stop();
return;
}
Device device = clContext.getDevices().get(0);
clQueue = clContext.createQueue(device);
clQueue.register();
String source = "" + "__kernel void Fill(__global float* vb, float v)\n" + "{\n" + " int idx = get_global_id(0);\n" + " vb[idx] = v;\n" + "}\n";
Program program = clContext.createProgramFromSourceCode(source);
program.build();
program.register();
kernel = program.createKernel("Fill");
kernel.register();
buffer = clContext.createBuffer(4);
buffer.register();
flyCam.setEnabled(false);
inputManager.setCursorVisible(true);
BitmapFont fnt = assetManager.loadFont("Interface/Fonts/Default.fnt");
infoText = new BitmapText(fnt, false);
//infoText.setBox(new Rectangle(0, 0, settings.getWidth(), settings.getHeight()));
infoText.setText("Device: " + clContext.getDevices());
infoText.setLocalTranslation(0, settings.getHeight(), 0);
guiNode.attachChild(infoText);
statusText = new BitmapText(fnt, false);
//statusText.setBox(new Rectangle(0, 0, settings.getWidth(), settings.getHeight()));
statusText.setText("Running");
statusText.setLocalTranslation(0, settings.getHeight() - infoText.getHeight() - 2, 0);
guiNode.attachChild(statusText);
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class TestOpenCLLibraries method simpleInitApp.
@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);
}
use of com.jme3.font.BitmapText in project jmonkeyengine by jMonkeyEngine.
the class TerrainTestModifyHeight method initCrossHairs.
protected void initCrossHairs() {
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);
}
Aggregations