Proper implementation of renderFont in nifty RenderDeviceJme, the last 2 floats are scaleX and scaleY. changed the method accordingly.

Old method is now deprecated and redirect to the new method

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8566 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 4c0f7b06ca
commit 630b594158
  1. 22
      engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java

@ -187,9 +187,23 @@ public class RenderDeviceJme implements RenderDevice {
quadColor.updateData(buf); quadColor.updateData(buf);
} }
/**
*
* @param font
* @param str
* @param x
* @param y
* @param color
* @param size
* @deprecated use renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY) instead
*/
@Deprecated
public void renderFont(RenderFont font, String str, int x, int y, Color color, float size){
renderFont(font, str, x, y, color, size, size);
}
@Override @Override
public void renderFont(RenderFont font, String str, int x, int y, Color color, float size, float f1){ public void renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY){
//TODO find out what the f1 param is for //TODO find out what the f1 param is for
if (str.length() == 0) if (str.length() == 0)
return; return;
@ -217,12 +231,12 @@ public class RenderDeviceJme implements RenderDevice {
float width = text.getLineWidth(); float width = text.getLineWidth();
float height = text.getLineHeight(); float height = text.getLineHeight();
float x0 = x + 0.5f * width * (1f - size); float x0 = x + 0.5f * width * (1f - sizeX);
float y0 = y + 0.5f * height * (1f - size); float y0 = y + 0.5f * height * (1f - sizeY);
tempMat.loadIdentity(); tempMat.loadIdentity();
tempMat.setTranslation(x0, getHeight() - y0, 0); tempMat.setTranslation(x0, getHeight() - y0, 0);
tempMat.setScale(size, size, 0); tempMat.setScale(sizeX, sizeY, 0);
rm.setWorldMatrix(tempMat); rm.setWorldMatrix(tempMat);
text.render(rm); text.render(rm);

Loading…
Cancel
Save