本文整理汇总了Java中com.jme3.font.BitmapText.updateLogicalState方法的典型用法代码示例。如果您正苦于以下问题:Java BitmapText.updateLogicalState方法的具体用法?Java BitmapText.updateLogicalState怎么用?Java BitmapText.updateLogicalState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.font.BitmapText
的用法示例。
在下文中一共展示了BitmapText.updateLogicalState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderFont
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
public void renderFont(RenderFont font, String str, int x, int y, Color color, float size){
if (str.length() == 0)
return;
if (font instanceof RenderFontNull)
return;
RenderFontJme jmeFont = (RenderFontJme) font;
BitmapText text = jmeFont.getText();
// WARNING: Not compatible with OpenGL1 implementations..
niftyMat.setColor("Color", convertColor(color, tempColor));
niftyMat.setBoolean("UseTex", true);
niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
text.setMaterial(niftyMat);
text.setText(str);
text.updateLogicalState(0);
float width = text.getLineWidth();
float height = text.getLineHeight();
float x0 = x + 0.5f * width * (1f - size);
float y0 = y + 0.5f * height * (1f - size);
tempMat.loadIdentity();
tempMat.setTranslation(x0, getHeight() - y0, 0);
tempMat.setScale(size, size, 0);
rm.setWorldMatrix(tempMat);
text.render(rm);
}
示例2: renderFont
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
@Override
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.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
// niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
text.setMaterial(niftyMat);
tempMat.loadIdentity();
tempMat.setTranslation(x, getHeight() - y, 0);
tempMat.setScale(sizeX, sizeY, 0);
rm.setWorldMatrix(tempMat);
text.render(rm);
// System.out.println("renderFont");
}
示例3: renderFont
import com.jme3.font.BitmapText; //导入方法依赖的package包/类
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");
}