Exemplo n.º 1
0
        public MonoSwich(MonoItemInfo itemInfo, bool isSwitched, Texture2D pressedTexture, SpriteFont font, Color fontColor, int x, int y) : base(itemInfo, font, fontColor, x, y)
        {
            _pressedTexture  = pressedTexture;
            _originalTexture = _texture;

            SetSwitched(isSwitched);
        }
Exemplo n.º 2
0
        protected Color _fontColor; // = Color.MintCream;

        public MonoItem(MonoItemInfo itemInfo, SpriteFont font, Color fontColor, int x, int y)
        {
            LeftTopX      = x;
            LeftTopY      = y;
            _font         = font;
            _action       = itemInfo.Action;
            _texture      = itemInfo.Texture;
            _innerTexture = itemInfo.InnerTexture;
            _text         = itemInfo.Text;
            _textColor    = fontColor;
            _fontColor    = fontColor;

            var height = 0;
            var width  = 0;

            if (_innerTexture != null)
            {
                height = _innerOffset + _innerTexture.Height;
                width  = _innerTexture.Width + _innerOffset;
            }

            if (_text != null)
            {
                var stringSize = _font.MeasureString(_text);
                width  = width + _innerOffset + (int)stringSize.X;
                height = Math.Max(height, 2 * _textOffset + (int)stringSize.Y);
            }

            Height = height + _innerOffset;
            Width  = width + _innerOffset;
        }