本文整理汇总了Java中com.jme3.font.Rectangle类的典型用法代码示例。如果您正苦于以下问题:Java Rectangle类的具体用法?Java Rectangle怎么用?Java Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle类属于com.jme3.font包,在下文中一共展示了Rectangle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: simpleInitApp
import com.jme3.font.Rectangle; //导入依赖的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);
}
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:TestBitmapText3D.java
示例2: simpleInitApp
import com.jme3.font.Rectangle; //导入依赖的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);
}
开发者ID:mleoking,项目名称:PhET,代码行数:27,代码来源:TestBitmapFont.java
示例3: updateView
import com.jme3.font.Rectangle; //导入依赖的package包/类
@Override
public void updateView() {
if (needToSetBox) {
bitmapText.setBox(new Rectangle(0, 0, width, height));
boxSet = true;
needToSetBox = false;
}
if (align != null) {
bitmapText.setAlignment(align);
align = null;
}
if (valign != null) {
bitmapText.setVerticalAlignment(valign);
valign = null;
}
bitmapText.updateLogicalState(0.16f);
Vector3f loc = bitmapText.getLocalTranslation();
bitmapText.setLocalTranslation(loc.set(0, height, 0));
super.updateView();
}
开发者ID:huliqing,项目名称:LuoYing,代码行数:25,代码来源:Text.java
示例4: calculatePreferredSize
import com.jme3.font.Rectangle; //导入依赖的package包/类
public void calculatePreferredSize( Vector3f size ) {
// Make sure that the bitmapText reports a reliable
// preferred size
bitmapText.setBox(null);
if( maxWidth > 0 ) {
// Give the text a box that constrains the width
bitmapText.setBox(new Rectangle(0, 0, maxWidth, 0));
}
size.x = bitmapText.getLineWidth();
size.y = bitmapText.getHeight();
if( offset != null ) {
size.x += Math.abs(offset.x);
size.y += Math.abs(offset.y);
size.z += Math.abs(offset.z);
}
size.x += 0.01f;
// Reset any text box we already had
bitmapText.setBox(textBox);
}
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:25,代码来源:TextComponent.java
示例5: reshape
import com.jme3.font.Rectangle; //导入依赖的package包/类
@Override
public void reshape(Vector3f pos, Vector3f size) {
bitmapText.setLocalTranslation(pos.x, pos.y, pos.z);
textBox = new Rectangle(0, 0, size.x, size.y);
bitmapText.setBox(textBox);
resetAlignment();
}
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:8,代码来源:TextEntryComponent.java
示例6: updateTextElement
import com.jme3.font.Rectangle; //导入依赖的package包/类
/**
* Updates the element's textlayer position and boundary
*/
protected void updateTextElement() {
if (textElement != null) {
textElement.setLocalTranslation(textPosition.x+textPadding.x, getHeight()-(textPosition.y+textPadding.z), textElement.getLocalTranslation().z);
textElement.setBox(new Rectangle(0,0,dimensions.x-(textPadding.x+textPadding.y),dimensions.y-(textPadding.z+textPadding.w)));
}
}
开发者ID:meltzow,项目名称:tonegodgui,代码行数:10,代码来源:Element.java
示例7: getTextTotalHeight
import com.jme3.font.Rectangle; //导入依赖的package包/类
/**
* Returns the total height of a wrapped text string
* @param ref Element The element the text will be added to (reference for font settings)
* @param text String the text to be evaluated
* @param maxWidth The maximum width considered a valid return value
* @return float
*/
public static float getTextTotalHeight(Element ref, String text, float maxWidth) {
BitmapText eval = new BitmapText(ref.getFont());
eval.setSize(ref.getFontSize());
eval.setText("Xg");
eval.setBox(new Rectangle(0,0,maxWidth, eval.getLineHeight()));
eval.setText(text);
return eval.getLineWidth()*eval.getLineCount();
}
开发者ID:meltzow,项目名称:tonegodgui,代码行数:17,代码来源:BitmapTextUtil.java
示例8: createBillboard
import com.jme3.font.Rectangle; //导入依赖的package包/类
public void createBillboard(AssetManager manager) {
// Set position above model
// Load font and create the Text
BitmapFont font = manager.loadFont("Interface/Fonts/Default.fnt");
BitmapText bmText = new BitmapText(font);
bmText.setSize(0.25f);
bmText.setText(actorName);
bmText.setQueueBucket(Bucket.Transparent);
bmText.setColor(ColorRGBA.Orange);
bmText.setBox(new Rectangle(-bmText.getLineWidth() / 2.0f - 0.2f, 0, bmText.getLineWidth() * 2.0f, bmText.getLineHeight() + 0.1f));
bmText.setAlignment(BitmapFont.Align.Left);
bmText.setLineWrapMode(LineWrapMode.NoWrap);
Vector3f newPos = new Vector3f(0, 2.5f, 0);
// Create node and add a BillboardControl so it rotates with the cam
BillboardControl bbControl = new BillboardControl();
bbControl.setAlignment(BillboardControl.Alignment.Screen);
Node textNode = new Node("Node for text");
textNode.setLocalTranslation(newPos);
textNode.setCullHint(CullHint.Never);
textNode.attachChild(bmText);
bmText.addControl(bbControl);
//Vector3f world = textNode.getWorldTranslation();
this.attachChild(textNode);
//System.out.println("Text node location for " + actorName + "," +world);
}
开发者ID:samynk,项目名称:DArtE,代码行数:31,代码来源:NPC.java
示例9: createPlayerName
import com.jme3.font.Rectangle; //导入依赖的package包/类
private void createPlayerName(String name, int teamId) {
BitmapText text = new BitmapText(guiFont);
text.setSize(guiFont.getCharSet().getRenderedSize() * 0.8f);
text.setBox(new Rectangle(0, 0, 80, 10));
text.setText(name);
text.setColor(TEAM_COLORS[teamId].clone());
text.setAlignment(BitmapFont.Align.Center);
text.center();
guiNode.attachChild(text);
text.setQueueBucket(RenderQueue.Bucket.Gui);
playerNames.add(text);
}
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:14,代码来源:VisualCharacterInfo.java
示例10: initNarratorText
import com.jme3.font.Rectangle; //导入依赖的package包/类
private void initNarratorText()
{
BitmapFont narratorTextFont = assetManager.loadFont("Interface/ArialRoundedMTBold.fnt");
narratorText = new BitmapText(narratorTextFont);
narratorText.setSize(narratorTextFont.getCharSet().getRenderedSize());
narratorText.setLineWrapMode(LineWrapMode.Word);
narratorText.setBox(new Rectangle(325,0, 1280 - 325*2, 200));
narratorText.setAlignment(BitmapFont.Align.Center);
narratorText.move(0, 200, 1);
narratorText.setColor(ColorRGBA.White);
createTextBackgound(1280 - 325*2, 150);
guiNode.attachChild(narratorText);
}
开发者ID:uprm-gaming,项目名称:jmonkey-narrator,代码行数:14,代码来源:Narrator.java
示例11: initNarratorText
import com.jme3.font.Rectangle; //导入依赖的package包/类
private void initNarratorText()
{
BitmapFont narratorTextFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
narratorText = new BitmapText(narratorTextFont);
narratorText.setSize(narratorTextFont.getCharSet().getRenderedSize());
narratorText.setLineWrapMode(LineWrapMode.Word);
narratorText.setBox(new Rectangle(325,0, 1280 - 325*2, 200));
narratorText.setAlignment(BitmapFont.Align.Center);
narratorText.move(0, 200, 1);
narratorText.setColor(ColorRGBA.White);
guiNode.attachChild(narratorText);
}
开发者ID:abnercoimbre,项目名称:tower-defense-cave,代码行数:13,代码来源:Narrator.java
示例12: setBoxSize
import com.jme3.font.Rectangle; //导入依赖的package包/类
@Override
public void setBoxSize(float width, float height)
{
this.boundingBox = new Rectangle(0, 0, width, height);
doUpdate();
}
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:7,代码来源:JMEMutableLabel.java
示例13: reshape
import com.jme3.font.Rectangle; //导入依赖的package包/类
public void reshape( Vector3f pos, Vector3f size ) {
if( offset != null ) {
// My gut is that we need to treat positive and negative
// differently... I will need to think about that some more
// or have some examples where this is failing.
// In the case where we have a positive offset then it is ok
// to draw ourselves spaced out and then shrink the size.
// If we have a negative offset, then we should be drawing
// ourselves where we are and then adjusting pos+size for the
// next guy.
// I'll fix it later FIXME
// Notes as of component stack refactoring... when testing
// I discovered that because of the way this is arranged, shadows
// are pushed back instead of pushing the layered text forward.
// Essentially, text does not at all play nice in layers.
// I need to test some other things before swing back to fix this
// because I may have already broken things with the component stack
// refactoring.
// Ok, so upon more reflection, I think offset will work like one
// would expect. Offset will set the position of this text relative
// to the passed in position... but that means that negative offsets
// are really just 0 and we instead push out the position.
// This means that something like shadow text with a -1 z will end up
// -1 behind the regular text because the regular text will get pushed
// out by 1.
// So a negative z offset results in z=0 for this text but pos.z += abs(z).
// A positive Z pushes us out and also moves pos.z+= z.
// Because we use offset z for size, this is really the only way it
// makes sense. offset.z will control the thickness and positive or
// negative indicates where in the "box" it falls (back or front)
float effectiveZ = Math.max(0, offset.z);
bitmapText.setLocalTranslation(pos.x + offset.x, pos.y + offset.y, pos.z + effectiveZ);
size.x -= Math.abs(offset.x);
size.y -= Math.abs(offset.y);
size.z -= Math.abs(offset.z);
pos.z += Math.abs(offset.z);
} else {
bitmapText.setLocalTranslation(pos.x, pos.y, pos.z);
}
textBox = new Rectangle(0, 0, size.x, size.y);
bitmapText.setBox( textBox );
resetAlignment();
}
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:45,代码来源:TextComponent.java
示例14: resetTextElement
import com.jme3.font.Rectangle; //导入依赖的package包/类
public void resetTextElement() {
if (textElement != null) {
textElement.setLocalTranslation(textPosition.x+textPadding.x, getHeight()-(textPosition.y+textPadding.z), textElement.getLocalTranslation().z);
textElement.setBox(new Rectangle(0,0,dimensions.x-(textPadding.x+textPadding.y),25));
}
}
开发者ID:meltzow,项目名称:tonegodgui,代码行数:7,代码来源:Element.java
示例15: updateToolTipLocation
import com.jme3.font.Rectangle; //导入依赖的package包/类
/**
* For internal use only - DO NOT CALL THIS METHOD
*/
@Override
public void updateToolTipLocation() {
if (toolTip == null) {
/*
* Initialize the global tool tip on first invocation.
*/
toolTip = new ToolTip(this, "GlobalToolTip", new Vector2f(0, 0), new Vector2f(200, 50));
toolTip.setIgnoreGlobalAlpha(true);
toolTip.setIsGlobalModal(true);
toolTip.setText("");
toolTip.setTextPadding(2);
toolTip.setTextPosition(0, 0);
toolTip.hide();
addElement(toolTip);
toolTip.move(0, 0, 20);
}
/*
* Determine what text (if any) the tool tip should display.
*/
String newText = null;
if (useToolTips && getApplication().getInputManager().isCursorVisible()) {
if (mouseFocusElement != null) {
newText = mouseFocusElement.getToolTipText();
} else {
newText = forcedToolTipText;
}
}
if (newText == null || newText.isEmpty()) {
/*
* Clear and hide the old tool tip.
*/
toolTip.setText("");
toolTip.hide();
return;
}
String oldText = toolTip.getText();
if (!oldText.equals(newText)) {
/*
* Change the tool tip text and resize the tool tip.
*/
toolTip.setText("");
toolTip.setHeight(25);
float finalWidth = BitmapTextUtil.getTextWidth(toolTip, newText, toolTipMaxWidth);
toolTip.setText(newText);
toolTip.setWidth(finalWidth + (toolTip.getTextPadding() * 12));
toolTip.setHeight(toolTip.getTextElement().getHeight() + (toolTip.getTextPadding() * 12));
toolTip.getTextElement().setBox(new Rectangle(0, 0, toolTip.getWidth() - (toolTip.getTextPadding() * 2), toolTip.getHeight() - (toolTip.getTextPadding() * 2)));
}
setToolTipLocation();
if (!toolTip.getIsVisible()) {
toolTip.show();
}
}
开发者ID:meltzow,项目名称:tonegodgui,代码行数:60,代码来源:Screen.java
注:本文中的com.jme3.font.Rectangle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论