From 630b594158df043c7761a4051f5a51ae5396d41f Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 1 Nov 2011 17:56:56 +0000 Subject: [PATCH] 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 --- .../com/jme3/niftygui/RenderDeviceJme.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java b/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java index 5d157d474..ac9cb16d6 100644 --- a/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java +++ b/engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java @@ -187,9 +187,23 @@ public class RenderDeviceJme implements RenderDevice { 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 - 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 if (str.length() == 0) return; @@ -217,12 +231,12 @@ public class RenderDeviceJme implements RenderDevice { float width = text.getLineWidth(); float height = text.getLineHeight(); - float x0 = x + 0.5f * width * (1f - size); - float y0 = y + 0.5f * height * (1f - size); + 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(size, size, 0); + tempMat.setScale(sizeX, sizeY, 0); rm.setWorldMatrix(tempMat); text.render(rm);