Beispiel #1
0
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            if (mode == EButtonMode.PushButton && pushed)
            {
                SkinLayer l = Skin.Layers[lrButton];
                renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);
                if (l.States.Pressed.Overlay)
                {
                    renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);
                }
            }
            else
            {
                base.DrawControl(renderer, rect, gameTime);
            }

            SkinLayer  layer = Skin.Layers[lrButton];
            SpriteFont font  = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
            Color      col   = Color.White;
            int        ox    = 0;
            int        oy    = 0;

            if (ControlState == EControlState.Pressed)
            {
                if (layer.Text != null)
                {
                    col = layer.Text.Colors.Pressed;
                }
                ox = 1;
                oy = 1;
            }
            if (glyph != null)
            {
                Margins   cont = layer.ContentMargins;
                Rectangle r    = new Rectangle(rect.Left + cont.Left,
                                               rect.Top + cont.Top,
                                               rect.Width - cont.Horizontal,
                                               rect.Height - cont.Vertical);
                renderer.DrawGlyph(glyph, r);
            }
            else
            {
                renderer.DrawString(this, layer, Text, rect, true, ox, oy);
            }
        }
Beispiel #2
0
		protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime) {

			if (mode == EButtonMode.PushButton && pushed) {
				SkinLayer l = Skin.Layers[lrButton];
				renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);
				if (l.States.Pressed.Overlay) {
					renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);
				}
			} else {
				base.DrawControl(renderer, rect, gameTime);
			}

			SkinLayer layer = Skin.Layers[lrButton];
			SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
			Color col = Color.White;
			int ox = 0;
			int oy = 0;

			if (ControlState == EControlState.Pressed) {
				if (layer.Text != null)
					col = layer.Text.Colors.Pressed;
				ox = 1;
				oy = 1;
			}
			if (glyph != null) {
				Margins cont = layer.ContentMargins;
				Rectangle r = new Rectangle(rect.Left + cont.Left,
											rect.Top + cont.Top,
											rect.Width - cont.Horizontal,
											rect.Height - cont.Vertical);
				renderer.DrawGlyph(glyph, r);
			} else {
				renderer.DrawString(this, layer, Text, rect, true, ox, oy);
			}
		}