OSDN Git Service

[fixed] issue 81
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sat, 18 Dec 2010 14:56:12 +0000 (14:56 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sat, 18 Dec 2010 14:56:12 +0000 (14:56 +0000)
gdx/src/com/badlogic/gdx/graphics/BitmapFont.java

index 6f0ae55..82b518b 100644 (file)
@@ -255,6 +255,7 @@ public class BitmapFont {
         *         instance is used for all methods that return TextBounds.\r
         */\r
        public TextBounds draw (SpriteBatch spriteBatch, CharSequence str, float x, float y, int start, int end) {\r
+               float batchColor = spriteBatch.getColor().toFloatBits();\r
                spriteBatch.setColor(color);\r
                final Texture texture = region.getTexture();\r
                y += ascent;\r
@@ -314,6 +315,7 @@ public class BitmapFont {
                                x += g.xadvance * scaleX;\r
                        }\r
                }\r
+               spriteBatch.setColor(batchColor);               \r
                textBounds.width = (int)(x - startX);\r
                textBounds.height = (int)capHeight;\r
                return textBounds;\r
@@ -340,6 +342,7 @@ public class BitmapFont {
         */\r
        public TextBounds drawMultiLine (SpriteBatch spriteBatch, CharSequence str, float x, float y, float alignmentWidth,\r
                HAlignment alignment) {\r
+               float batchColor = spriteBatch.getColor().toFloatBits();\r
                float down = this.down;\r
                int start = 0;\r
                int numLines = 0;\r
@@ -359,6 +362,8 @@ public class BitmapFont {
                        y += down;\r
                        numLines++;\r
                }\r
+               spriteBatch.setColor(batchColor);\r
+               \r
                textBounds.width = maxWidth;\r
                textBounds.height = (int)(capHeight + (numLines - 1) * lineHeight);\r
                return textBounds;\r
@@ -386,6 +391,7 @@ public class BitmapFont {
         */\r
        public TextBounds drawWrapped (SpriteBatch spriteBatch, CharSequence str, float x, float y, float wrapWidth,\r
                HAlignment alignment) {\r
+               float batchColor = spriteBatch.getColor().toFloatBits();\r
                float down = this.down;\r
                int start = 0;\r
                int numLines = 0;\r
@@ -423,6 +429,7 @@ public class BitmapFont {
                        y += down;\r
                        numLines++;\r
                }\r
+               spriteBatch.setColor(batchColor);               \r
                textBounds.width = maxWidth;\r
                textBounds.height = (int)(capHeight + (numLines - 1) * lineHeight);\r
                return textBounds;\r