示例#1
0
        static public void Draw(ref string txt)
        {
            if (txt == null || txt == "")
            {
                return;
            }
            float newlineShift = 0;

#if SUPPORTS_FRB_DRAWN_GUI
            if (TextManager.DefaultFont.Texture != GuiManager.guiTexture)
            {
                GuiManager.AddTextureSwitch(TextManager.DefaultFont.Texture, false);
            }
#endif

            if (txt.Contains("\n"))
            {
                string[] lines = txt.Split('\n');

                // now we need to truncate the strings so that they fit in the width


                for (int lnNum = 0; lnNum < lines.Length; lnNum++)
                {
                    string textToWrite = lines[lnNum];

                    DrawSingleLineString(ref textToWrite, ref newlineShift);

                    if (lnNum != lines.Length - 1)
                    {
                        newlineShift -= mNewLineDistanceForVertexBuffer;
                    }
                }
            }
            else
            {
                DrawSingleLineString(ref txt, ref newlineShift);
            }

#if SUPPORTS_FRB_DRAWN_GUI
            if (TextManager.DefaultFont.Texture != GuiManager.guiTexture)
            {
                GuiManager.AddTextureSwitch(GuiManager.guiTexture, false);
            }
#endif
        }