Пример #1
0
        public virtual AsSprite createSprite(float width, float height, String text, float fontSize, uint color, String hAlign, String vAlign, bool autoScale, bool kerning)
        {
            AsVector <AsCharLocation> charLocations = arrangeChars(width, height, text, fontSize, hAlign, vAlign, autoScale, kerning);
            int      numChars = (int)(charLocations.getLength());
            AsSprite sprite   = new AsSprite();
            int      i        = 0;

            for (; i < numChars; ++i)
            {
                AsCharLocation charLocation = charLocations[i];
                AsImage        _char        = charLocation._char.createImage();
                _char.setX(charLocation.x);
                _char.setY(charLocation.y);
                _char.setScaleX(_char.setScaleY(charLocation.scale));
                _char.setColor(color);
                sprite.addChild(_char);
            }
            return(sprite);
        }
Пример #2
0
        public virtual void fillQuadBatch(AsQuadBatch quadBatch, float width, float height, String text, float fontSize, uint color, String hAlign, String vAlign, bool autoScale, bool kerning)
        {
            AsVector <AsCharLocation> charLocations = arrangeChars(width, height, text, fontSize, hAlign, vAlign, autoScale, kerning);
            int numChars = (int)(charLocations.getLength());

            mHelperImage.setColor(color);
            if (numChars > 8192)
            {
                throw new AsArgumentError("Bitmap Font text is limited to 8192 characters.");
            }
            int i = 0;

            for (; i < numChars; ++i)
            {
                AsCharLocation charLocation = charLocations[i];
                mHelperImage.setTexture(charLocation._char.getTexture());
                mHelperImage.readjustSize();
                mHelperImage.setX(charLocation.x);
                mHelperImage.setY(charLocation.y);
                mHelperImage.setScaleX(mHelperImage.setScaleY(charLocation.scale));
                quadBatch.addImage(mHelperImage);
            }
        }