public override void Render(DwarfTime time, SpriteBatch batch) { if (!IsVisible) { return; } Rectangle globalBounds = GlobalBounds; Color imageColor = Color.White; Color textColor = TextColor; Color strokeColor = GUI.DefaultStrokeColor; if (IsLeftPressed) { imageColor = PressedTint; textColor = PressedTextColor; } else if (IsMouseOver) { imageColor = HoverTint; textColor = HoverTextColor; } if (CanToggle && IsToggled) { imageColor = ToggleTint; } imageColor.A = Transparency; Rectangle imageBounds = GetImageBounds(); switch (Mode) { case ButtonMode.ImageButton: if (DrawFrame) { GUI.Skin.RenderButtonFrame(imageBounds, batch); } Rectangle bounds = imageBounds; if (Image != null && Image.Image != null) { batch.Draw(Image.Image, bounds, Image.SourceRect, imageColor); } Drawer2D.DrawAlignedText(batch, Text, TextFont, textColor, Drawer2D.Alignment.Under | Drawer2D.Alignment.Center, new Rectangle(bounds.X + 2, bounds.Y + 4, bounds.Width, bounds.Height), true); if (IsToggled) { Drawer2D.DrawRect(batch, GetImageBounds(), Color.White, 2); } break; case ButtonMode.PushButton: if (DrawFrame) { GUI.Skin.RenderButton(GlobalBounds, batch); } Drawer2D.DrawAlignedStrokedText(batch, Text, TextFont, textColor, strokeColor, Drawer2D.Alignment.Center, GlobalBounds, true); break; case ButtonMode.ToolButton: if (DrawFrame) { GUI.Skin.RenderButton(GlobalBounds, batch); } if (Image != null && Image.Image != null) { Rectangle imageRect = GetImageBounds(); Rectangle alignedRect = Drawer2D.Align(GlobalBounds, imageRect.Width, imageRect.Height, Drawer2D.Alignment.Left); alignedRect.X += 5; batch.Draw(Image.Image, alignedRect, Image.SourceRect, imageColor); } Drawer2D.DrawAlignedStrokedText(batch, Text, TextFont, textColor, strokeColor, Drawer2D.Alignment.Center, GlobalBounds, true); if (IsToggled) { Drawer2D.DrawRect(batch, GetImageBounds(), Color.White, 2); } break; case ButtonMode.TabButton: GUI.Skin.RenderTab(GlobalBounds, batch, IsToggled ? Color.White : Color.LightGray); Drawer2D.DrawAlignedStrokedText(batch, Text, TextFont, textColor, strokeColor, Drawer2D.Alignment.Top, new Rectangle(GlobalBounds.X, GlobalBounds.Y + 2, GlobalBounds.Width, GlobalBounds.Height), true); break; } base.Render(time, batch); }