Beispiel #1
0
 public void OnLoadContent(ContentManager contentManager, string selectedImageName,
                           string notSelectedImageName, string disabledImageName)
 {
     selected    = ScreenUtils.GetTexture(selectedImageName);
     notSelected = ScreenUtils.GetTexture(notSelectedImageName);
     disabled    = ScreenUtils.GetTexture(disabledImageName);
 }
Beispiel #2
0
        /// <summary>
        /// Creates a new primitive line object.
        /// </summary>
        /// <param name="graphicsDevice">The Graphics Device object to use.</param>
        public PrimitiveLine()
        {
            // create pixels
            pixel = ScreenUtils.CreateTexture(1, 1, SurfaceFormat.Color);
            Color[] pixels = new Color[1];
            pixels[0] = Color.White;
            pixel.SetData <Color>(pixels);

            Colour   = Color.White;
            Position = new Vector2(0, 0);
            Depth    = 0;

            vectors = new List <Vector2>();
        }
Beispiel #3
0
        public void SetLabel(SpriteFont font, String labelString, Color color)
        {
            if (labelString == null)
            {
                label = null;
            }

            if (notSelected == null)
            {
                throw new InvalidOperationException("Button textures not loaded yet, cannot put label");
            }
            Vector2 labelSize = font.MeasureString(labelString);

            label = ScreenUtils.CreateTexture(width, height, labelString, Color.Transparent, color, font);
        }
Beispiel #4
0
        public void SetLabel(Color selectedColor,
                             Color notSelectedColor, Color disabledColor, Color labelColor,
                             String fontName, String label, int width, int height)
        {
            bool shouldInitialize = selected == null;

            selected = ScreenUtils.CreateTexture(width, height, label,
                                                 labelColor, selectedColor, ScreenUtils.GetFont(fontName));

            notSelected = ScreenUtils.CreateTexture(width, height, label,
                                                    labelColor, notSelectedColor, ScreenUtils.GetFont(fontName));

            disabled = ScreenUtils.CreateTexture(width, height, label,
                                                 labelColor, disabledColor, ScreenUtils.GetFont(fontName));

            if (shouldInitialize)
            {
                OnLoadContentCommon();
            }
        }