Ejemplo n.º 1
0
        public override void LoadContent(IAssetManager assetManager)
        {
            base.LoadContent(assetManager);
            _assetManager = assetManager;

            switch (TextSize) {
                case TextSize.Large:
                    Font = assetManager.LoadFont(FontName, ControlManager.Config.WindowLargeFontSize, FontWeight.Normal, FontStyle.Normal, FontStretch.Normal);
                    break;

                case TextSize.Normal:
                    goto default;

                default:
                    Font = assetManager.LoadFont(FontName, ControlManager.Config.WindowStandardFontSize, FontWeight.Normal, FontStyle.Normal, FontStretch.Normal);
                    break;
            }

            if (!String.IsNullOrEmpty(ActiveTexturePath)) {
                _activeTexture = assetManager.LoadTexture(ActiveTexturePath);

                if (String.IsNullOrEmpty(InactiveTexturePath))
                    _inactiveTexture = _activeTexture;
                else
                    _inactiveTexture = assetManager.LoadTexture(InactiveTexturePath);

                if (String.IsNullOrEmpty(PressedTexturePath))
                    _pressedTexture = _activeTexture;
                else
                    _pressedTexture = assetManager.LoadTexture(PressedTexturePath);
            }

            if (_activeTexture == null) {
                _activeBackgroundBrush = assetManager.LoadBrush(this.ActiveBackgroundColor);
            } else {
                _activeBackgroundBrush = assetManager.LoadBrush(_activeTexture.Resource, new BitmapBrushProperties() {
                    ExtendModeX = ExtendMode.Wrap,
                    ExtendModeY = ExtendMode.Wrap,
                    InterpolationMode = BitmapInterpolationMode.Linear
                }, null);
            }
            _activeBorderBrush = assetManager.LoadBrush(this.ActiveBorderColor);

            if (_inactiveTexture == null) {
                _inactiveBackgroundBrush = assetManager.LoadBrush(this.InactiveBackgroundColor);
            } else {
                _inactiveBackgroundBrush = assetManager.LoadBrush(_inactiveTexture.Resource, new BitmapBrushProperties() {
                    ExtendModeX = ExtendMode.Wrap,
                    ExtendModeY = ExtendMode.Wrap,
                    InterpolationMode = BitmapInterpolationMode.Linear
                }, null);
            }
            _inactiveBorderBrush = assetManager.LoadBrush(this.InactiveBorderColor);
            _pressedBackgroundBrush = assetManager.LoadBrush(this.PressedBackgroundColor);
            _pressedBorderBrush = assetManager.LoadBrush(this.PressedBorderColor);
            _activeFontBrush = assetManager.LoadBrush(this.ActiveFontColor);
            _inactiveFontBrush = assetManager.LoadBrush(this.InactiveFontColor);
        }
 public void LoadContent(IAssetManager assets)
 {
     _buffer.Clear();
     _assetManager = assets;
     _font = ToDispose<FontAsset>(assets.LoadFont(FONT_NAME, FONT_SIZE, FontWeight.Normal, FontStyle.Normal, FontStretch.Normal));
     _backgroundColor = ToDispose<BrushAsset>(assets.LoadBrush(BACKGROUND));
     _standardColor = ToDispose<BrushAsset>(assets.LoadBrush(NORMALTEXT));
     _errorColor = ToDispose<BrushAsset>(assets.LoadBrush(ERRORTEXT));
 }
 public void LoadContent(IAssetManager assets)
 {
     _assetManager = assets;
     _font = ToDispose<FontAsset>(assets.LoadFont(FONT_NAME, FONT_SIZE, FontWeight.Normal, FontStyle.Normal, FontStretch.Normal));
     _currentLayout = ToDispose<TextLayout>(assets.MakeTextLayout(_font.Resource, "", float.MaxValue, float.MaxValue));
     _cursor = ToDispose<TextLayout>(assets.MakeTextLayout(_font.Resource, CURSOR, float.MaxValue, float.MaxValue));
     _lineSpacing = _cursor.Metrics.Height;
     _backgroundColor = ToDispose<BrushAsset>(assets.LoadBrush(BACKGROUND));
     _textColor = ToDispose<BrushAsset>(assets.LoadBrush(TEXT));
     Reset();
 }