1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-26 18:19:24 +01:00
MLEM/MLEM.Ui/Style/UntexturedStyle.cs

62 lines
3 KiB
C#
Raw Normal View History

2019-08-10 21:37:10 +02:00
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
2019-08-10 21:37:10 +02:00
using MLEM.Font;
namespace MLEM.Ui.Style {
2020-05-22 17:02:24 +02:00
/// <summary>
/// The default, untextured <see cref="UiStyle"/>.
/// Note that, as MLEM does not provide any texture or font assets, this default style is made up of single-color textures that were generated using <see cref="SpriteBatchExtensions.GenerateTexture"/>.
/// </summary>
2019-08-10 21:37:10 +02:00
public class UntexturedStyle : UiStyle {
2020-05-22 17:02:24 +02:00
/// <summary>
/// Creates a new untextured style with textures generated by the given sprite batch
/// </summary>
/// <param name="batch">The sprite batch to generate the textures with</param>
2019-08-10 21:37:10 +02:00
public UntexturedStyle(SpriteBatch batch) {
this.SelectionIndicator = batch.GenerateTexture(Color.Transparent, Color.Red);
this.ButtonTexture = batch.GenerateTexture(Color.CadetBlue);
2019-08-10 21:37:10 +02:00
this.ButtonHoveredColor = Color.LightGray;
2020-01-15 17:05:28 +01:00
this.ButtonDisabledColor = Color.Gray;
this.PanelTexture = batch.GenerateTexture(Color.Gray);
this.TextFieldTexture = batch.GenerateTexture(Color.MediumBlue);
2019-08-10 21:37:10 +02:00
this.TextFieldHoveredColor = Color.LightGray;
this.ScrollBarBackground = batch.GenerateTexture(Color.LightBlue);
this.ScrollBarScrollerTexture = batch.GenerateTexture(Color.Blue);
this.CheckboxTexture = batch.GenerateTexture(Color.LightBlue);
this.CheckboxHoveredColor = Color.LightGray;
this.CheckboxCheckmark = batch.GenerateTexture(Color.Blue).Region;
this.RadioTexture = batch.GenerateTexture(Color.AliceBlue);
this.RadioHoveredColor = Color.LightGray;
this.RadioCheckmark = batch.GenerateTexture(Color.CornflowerBlue).Region;
this.TooltipBackground = batch.GenerateTexture(Color.Black * 0.65F, Color.Black * 0.65F);
this.TooltipOffset = new Vector2(8, 16);
this.ProgressBarTexture = batch.GenerateTexture(Color.RoyalBlue);
2019-09-10 23:28:25 +02:00
this.ProgressBarColor = Color.White;
this.ProgressBarProgressPadding = new Vector2(1);
2019-09-10 23:28:25 +02:00
this.ProgressBarProgressColor = Color.Red;
2019-08-10 21:37:10 +02:00
this.Font = new EmptyFont();
}
2020-03-28 22:25:06 +01:00
private class EmptyFont : GenericFont {
2019-08-10 21:37:10 +02:00
public override GenericFont Bold => this;
public override GenericFont Italic => this;
2020-03-28 22:25:06 +01:00
public override float LineHeight => 1;
2020-06-20 12:12:34 +02:00
protected override Vector2 MeasureChar(char c) {
return Vector2.Zero;
2019-08-10 21:37:10 +02:00
}
2020-03-28 22:25:06 +01:00
public override void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
2019-08-10 21:37:10 +02:00
}
2020-03-28 22:25:06 +01:00
public override void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
2019-09-05 18:15:51 +02:00
}
2019-08-10 21:37:10 +02:00
}
}
}