本文整理汇总了Java中com.jme3.font.BitmapFont类的典型用法代码示例。如果您正苦于以下问题:Java BitmapFont类的具体用法?Java BitmapFont怎么用?Java BitmapFont使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BitmapFont类属于com.jme3.font包,在下文中一共展示了BitmapFont类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.jme3.font.BitmapFont; //导入依赖的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);
}
示例2: FriendPanel
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public FriendPanel(ElementManager screen, Persona character) {
super(screen);
this.character = character;
setLayoutManager(new MigLayout(screen, "ins 0, wrap 1", "[grow, fill]", "[align top][align bottom]"));
setIgnoreMouse(true);
// Name
Label nameLabel = new Label(screen);
nameLabel.setTextVAlign(BitmapFont.VAlign.Top);
nameLabel.setText(character.getDisplayName());
ElementStyle.normal(screen, nameLabel, true, false);
addChild(nameLabel);
// Details
Label details = new Label(screen);
details.setText(String.format("Level: %s %s", character.getLevel(), Icelib.toEnglish(character.getProfession())));
ElementStyle.small(screen, details);
addChild(details);
// Status
Label status = new Label(screen);
status.setText(String.format("%s", character.getStatusText() == null ? "-No Status Set-" : character.getStatusText()));
ElementStyle.normal(screen, status, true, false);
addChild(status);
}
示例3: createSpeechBubble
import com.jme3.font.BitmapFont; //导入依赖的package包/类
private Element createSpeechBubble(String text, final ChannelType channel) {
Element el = new Element(screen, UIDUtil.getUID(), Vector2f.ZERO,
screen.getStyle("SpeechBubble").getVector2f("defaultSize"),
screen.getStyle("SpeechBubble").getVector4f("resizeBorders"),
screen.getStyle("SpeechBubble").getString("defaultImg")) {
{
LUtil.removeEffects(this);
populateEffects("SpeechBubble");
}
};
el.setTextWrap(LineWrapMode.Word);
el.setTextAlign(BitmapFont.Align.Center);
el.setTextVAlign(BitmapFont.VAlign.Center);
el.setFont(screen.getStyle("Font").getString(screen.getStyle("SpeechBubble").getString("fontName")));
el.setFontSize(screen.getStyle("SpeechBubble").getFloat("fontSize"));
el.setClipPadding(screen.getStyle("SpeechBubble").getFloat("clipPadding"));
el.setFontColor(UIUtil.fromColorString(
Config.get().node(Config.CHAT_CHANNELS).node(channel.name()).get("color", Icelib.toHexString(channel.getColor()))));
el.setText(text);
return el;
}
示例4: CharacterPanel
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public CharacterPanel(Screen screen, Persona character, boolean sel) {
super(screen);
this.character = character;
setIgnoreMouse(true);
setLayoutManager(new MigLayout(screen, "ins 0, wrap 1, gap 0, fill", "[grow, fill]", "[align top][align bottom]"));
// Name
Label nameLabel = new Label(screen);
nameLabel.setIgnoreMouse(true);
nameLabel.setTextVAlign(BitmapFont.VAlign.Top);
nameLabel.setText(character.getDisplayName());
ElementStyle.medium(screen, nameLabel, true, false);
addChild(nameLabel);
// Details
Label details = new Label(screen);
details.setIgnoreMouse(true);
ElementStyle.altColor(screen, details);
details.setText(String.format("Level: %s %s %s", character.getLevel(), Icelib.toEnglish(character.getAppearance().getRace()), Icelib.toEnglish(character.getProfession())));
addChild(details);
}
示例5: simpleInitApp
import com.jme3.font.BitmapFont; //导入依赖的package包/类
@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);
}
示例6: simpleInitApp
import com.jme3.font.BitmapFont; //导入依赖的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);
}
示例7: StatsView
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public StatsView(String name, AssetManager manager, Statistics stats){
super(name);
setQueueBucket(Bucket.Gui);
setCullHint(CullHint.Never);
statistics = stats;
statLabels = statistics.getLabels();
statData = new int[statLabels.length];
labels = new BitmapText[statLabels.length];
BitmapFont font = manager.loadFont("Interface/Fonts/Console.fnt");
for (int i = 0; i < labels.length; i++){
labels[i] = new BitmapText(font);
labels[i].setLocalTranslation(0, labels[i].getLineHeight() * (i+1), 0);
attachChild(labels[i]);
}
addControl(this);
}
示例8: getPixelUnitFactor
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public final float getPixelUnitFactor(boolean isHor) {
switch (PlatformDefaults.getLogicalPixelBase()) {
case PlatformDefaults.BASE_FONT_SIZE:
BitmapFont bmf = getFont();
if (bmf == null) {
return 1f;
}
float f = isHor ? bmf.getLineWidth("W") / 5f : bmf.getPreferredSize() / 13f;
return f;
case PlatformDefaults.BASE_SCALE_FACTOR:
Float s = isHor ? PlatformDefaults.getHorizontalScaleFactor() : PlatformDefaults.getVerticalScaleFactor();
if (s != null) {
return s.floatValue();
}
return (isHor ? getHorizontalScreenDPI() : getVerticalScreenDPI())
/ (float) PlatformDefaults.getDefaultDPI();
default:
return 1f;
}
}
示例9: ItemRow
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public ItemRow(ListView listView) {
super(listView);
this.setLayout(Layout.horizontal);
icon = new ColumnIcon(height, height, InterfaceConstants.UI_MISS);
body = new ColumnBody(height, height, "", "");
cost = new ColumnText(height, height, "");
cost.setAlignment(BitmapFont.Align.Left);
num = new ColumnText(height, height, "");
num.setAlignment(BitmapFont.Align.Right);
button = new Button(ResourceManager.get(ResConstants.CHAT_SHOP_BUY));
button.setFontSize(UIFactory.getUIConfig().getDesSize());
addView(icon);
addView(body);
addView(cost);
addView(num);
addView(button);
button.addClickListener(new Listener() {
@Override
public void onClick(UI view, boolean isPressed) {
if (isPressed) return;
chatNetwork.chatShop(actor, gameService.getPlayer(), data.getUniqueId(), 1, discount);
}
});
}
示例10: ButtonWindow
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public ButtonWindow(BaseScreen screen, boolean closeable) {
super(screen, null, null, null, closeable);
form = new Form(screen);
getContentArea().setLayoutManager(new MigLayout(screen, "wrap 1", "[fill, grow]", "[fill, grow][shrink 0]"));
// Dialog
contentArea = createContent();
getContentArea().addElement(contentArea);
// Button Bar
Element buttons = new Element(screen, new FlowLayout(BitmapFont.Align.Center)) {
{
setStyleClass("dialog-buttons");
}
};
createButtons(buttons);
getContentArea().addElement(buttons, "growx");
}
示例11: createSheet
import com.jme3.font.BitmapFont; //导入依赖的package包/类
@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;
}
示例12: Footer
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public Footer(float width, float height) {
super(width, height);
setLayout(Layout.horizontal);
setBackground(UIFactory.getUIConfig().getBackground(), true);
setBackgroundColor(UIFactory.getUIConfig().getFooterBgColor(), false);
goldsIcon = new Icon(UIFactory.getUIConfig().getMissIcon());
goldsIcon.setWidth(height * 0.8f);
goldsIcon.setHeight(height * 0.8f);
goldsIcon.setMargin(10, height * 0.11f, 0, 0);
goldsRemain = new Text("");
goldsRemain.setWidth(width - goldsIcon.getWidth());
goldsRemain.setHeight(height);
goldsRemain.setFontSize(UIFactory.getUIConfig().getDesSize());
goldsRemain.setVerticalAlignment(BitmapFont.VAlign.Center);
goldsRemain.setMargin(10, 0, 0, 2);
addView(goldsIcon);
addView(goldsRemain);
}
示例13: ItemTitle
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public ItemTitle(float width, float height) {
super(width, height);
icon = new Text("");
icon.setHeight(height);
icon.setFontSize(UIFactory.getUIConfig().getDesSize());
icon.setFontColor(UIFactory.getUIConfig().getDesColor());
icon.setVerticalAlignment(BitmapFont.VAlign.Center);
name = new Text(ResourceManager.get(ResConstants.COMMON_NAME));
name.setHeight(height);
name.setFontSize(UIFactory.getUIConfig().getDesSize());
name.setFontColor(UIFactory.getUIConfig().getDesColor());
name.setVerticalAlignment(BitmapFont.VAlign.Center);
total = new Text(ResourceManager.get(ResConstants.COMMON_TOTAL));
total.setHeight(height);
total.setFontSize(UIFactory.getUIConfig().getDesSize());
total.setFontColor(UIFactory.getUIConfig().getDesColor());
total.setVerticalAlignment(BitmapFont.VAlign.Center);
addView(icon);
addView(name);
addView(total);
}
示例14: SimpleCheckbox
import com.jme3.font.BitmapFont; //导入依赖的package包/类
public SimpleCheckbox(String labelText) {
super(128, 32);
checkbox = new Checkbox();
label = new Text(labelText);
label.setVerticalAlignment(BitmapFont.VAlign.Center);
label.addClickListener(new Listener() {
@Override
public void onClick(UI view, boolean isPressed) {
if (isPressed) return;
checkbox.setChecked(!checkbox.isChecked());
}
});
setLayout(Layout.horizontal);
addView(checkbox);
addView(label);
}
示例15: updateViewChildren
import com.jme3.font.BitmapFont; //导入依赖的package包/类
@Override
public void updateViewChildren() {
super.updateViewChildren();
float w = getContentWidth();
float h = getContentHeight();
subtract.setWidth(w * 0.4f);
subtract.setHeight(h);
sizeText.setWidth(w * 0.2f);
sizeText.setHeight(h);
sizeText.setAlignment(BitmapFont.Align.Center);
sizeText.setVerticalAlignment(BitmapFont.VAlign.Center);
add.setWidth(w * 0.4f);
add.setHeight(h);
}