Game Development Community

GUITextStyle problems

by Vishal Bhanderi · in · 11/16/2008 (6:00 am) · 2 replies

Hi guys,

I was copying the code on page 340 which is similar to:
private void CreateMenuTitle()
        {
            GUITextStyle textStyle = new GUITextStyle();
            textStyle.FontType = "arial16";
            textStyle.SizeToText = true;
            textStyle.TextColor = Color.White;//This gives a compliation error

            _menuTitle = new GUIText();
            _menuTitle.Style = textStyle;
            _menuTitle.Text = "Main Menu";
            _menuTitle.Position = new Vector2(60f, 10);
            _menuTitle.Visible = true;
            _menuTitle.Folder = this;
        }

        GUIText _menuTitle;
But it wouldn't compile. I'm assuming it was old code (TX1), but how do I change the colour of the text now?

Thanks
Vishal

#1
11/16/2008 (11:29 am)
Vishal,

Make sure that you have

using Microsoft.Xna.Framework.Graphics;
added to the top of the project..

and
Change that line to
textStyle.TextColor[0] = Color.White;
#2
11/16/2008 (1:32 pm)
Ahh, TextColor is an array type. I got it working now.

Thanks Sean.