public static float drawTextWrap(float x, float y, float width, float height, int horzAlign, int vertAlign, AngelCodeFont font, Color c, String baseText)
    {
        ArrayList<String> textSplit = new ArrayList(Arrays.asList(baseText.split(" ")));
        ArrayList<String> texts = new ArrayList<String>();
        String line = "";
        while(textSplit.size() > 0)
        {
            String lineBuffer;
            line = textSplit.remove(0);
            while(textSplit.size() > 0)
            {
                lineBuffer = line + textSplit.get(0);
                if(font.getWidth(lineBuffer) <= width)
                {
                    line += " " + textSplit.remove(0);
                }
                else
                {
                    texts.add(line);
                    line = "";
                    break;
                }
            }
        }
        if(!line.equals(""))
            texts.add(line);


        float yDiff = 0;
        float lineHeight = font.getLineHeight()*LINE_HEIGHT_SCALE;
        switch (vertAlign)
        {
            case TEXT_TOP: yDiff = 0; break;
            case TEXT_CENTER: yDiff = (height/lineHeight - texts.size())*lineHeight/2f; break;
            case TEXT_BOTTOM: yDiff = (height/lineHeight - texts.size())*lineHeight; break;
        }
        for(int id = 0;id < texts.size();id++)
        {
            drawText(x, y+(id*lineHeight)+yDiff, width, 0, horzAlign, vertAlign, font, c, texts.get(id));
        }

        return lineHeight*texts.size();
    }