public TextContainer(Libraries.Font font, float width, float height = 0f, string text = null) { this.font = font; this.width = width; this.height = height; lineSpacing = (float)font.SpriteFont.LineSpacing; avgCharWidth = font.SpriteFont.MeasureString("Abcd efgh ijkl mnop, qrst uv wxyz.").X / 34f; //maxCharWidth = font.MeasureString("MMMMMMMMMMMMMMMMMMMM").X / 20f; wrappable = true; //scrollable = true; //alignTop = true; cursorX = 0; cursorY = 0; cursorVisible = true; cursorFollow = true; lines = new LinkedList <TextLine>(); if (text != null) { lines.AddFirst(new TextLine(text)); Update(); cursorX = lines.Last.Value.Text.Length; cursorY = lines.Count - 1; } }
//public float X { get { return x; } set { x = value; } } public TextState(Libraries.Font font, string message = "", float x = 0f, float y = 0f, Color color = default(Color), float scale = 1f) { this.font = font; this.message = message; this.x = x; this.y = y; this.color = color; this.scale = scale; Visible = true; }
public Entity AddText(string fontpath, string message, float x = 0f, float y = 0f, Color color = default(Color), float scale = 1f) { Libraries.Font font = GlobalServices.GlobalFonts.Register(fontpath); textState = new TextState(font, message, x, y, color, scale); if (bodyState != null) { textState.AddBody(bodyState); } return(this); }
//public TextContainer TextContainer { get { return textContainer; } set { textContainer = value; } } //public string Message { get { return message; } set { message = value; } } //public float X { get { return x; } set { x = value; } } public TextBoxState(Libraries.Font font, float x, float y, float width, float height, float padding, Color color = default(Color), string text = "") { this.font = font; this.x = x; this.y = y; this.width = width; this.height = height; this.padding = padding; this.color = color; Visible = true; textContainer = new Util.TextContainer(font, width - padding * 2, height - padding * 2, text); }
public TextComponent(Libraries.Font font, string value) { Font = font; Value = value; Color = Color.White; }
public Entity AddTextBox(string fontpath, float x, float y, float width, float height, float padding, Color color = default(Color), string text = "") { Libraries.Font font = GlobalServices.GlobalFonts.Register(fontpath); TextBoxState = new TextBoxState(font, x, y, width, height, padding, color, text); return(this); }