public TextButton(Position position, Gamestate gamestate, Vector2f margins, int fontSize, TextPosition horizontalPosition, TextPosition verticalPosition, string text) : base(position, gamestate) { if (text.Length == 0) { throw new ArgumentException("Text cannot be empty", "text"); } ButtonRectangle = new RenderRoundedRectangle(new Position(), this, Color.White, new Color(120, 160, 255), CalculateScreenSpaceHeight(5), CalculateScreenSpaceHeight(20)); ButtonText = new AlignedRenderText(new Position(), margins, 0, horizontalPosition, verticalPosition, this, Color.Black, text); FontSize = fontSize; }
public TextInput(Position position, Gamestate gamestate, Vector2f margins, int fontSize, TextPosition horizontalPosition, TextPosition verticalPosition, string text, Action <TextInput, TextEventArgs> action, int id) : base(position, gamestate, id) { MessageBus.Instance.Register(MessageType.LoseFocus, OnLostFocus); MessageBus.Instance.Register(MessageType.Input, OnInput); Action = action; FontSize = fontSize; Text = text; InputRectangle = new RenderRoundedRectangle(new Position(), this, Color.White, new Color(120, 160, 255), CalculateScreenSpaceHeight(5), CalculateScreenSpaceHeight(20)); InputText = new AlignedRenderText(new Position(), margins, 0, horizontalPosition, verticalPosition, this, Color.Black, Text); RecalculateComponentsPositions(); }
public Text(Position position, Gamestate gamestate, Vector2f margins, int fontSize, TextPosition horizontalPosition, TextPosition verticalPosition, string text) : base(position, gamestate) { if (text.Length == 0) { throw new ArgumentException("Text cannot be empty", "text"); } FontSize = fontSize; TextText = new AlignedRenderText(new Position(), margins, 0, horizontalPosition, verticalPosition, this, Color.Black, text); RecalculateComponentsPositions(); }
public RangeInput(Position position, Gamestate gamestate, PlayersManager playersManager, int startValue, int minValue, int maxValue, Color color, Action <RangeInput, int> action, int id) : base(position, gamestate, id) { PlayersManager = playersManager; Value = startValue; MinValue = minValue; MaxValue = maxValue; Action = action; LeftOffset = CalculateLeftOffset(); CollisionBox = new RenderRectangle(CalculateScreenSpacePosition(new Position(Position.X, Position.Y, Position.Width, Position.Height)), this, new Color(0, 0, 0, 0)); Bar = new RenderRectangle(CalculateScreenSpacePosition(new Position(Position.X, Position.Y + Position.Height / 3, Position.Width, Position.Height / 3)), this, color); Circle = new RenderCircle(CalculateScreenSpacePosition(new Position(Position.X + LeftOffset, Position.Y, 0, Position.Height / 2)), this, Color.White, color, Position.Height / 16); Text = new AlignedRenderText(CalculateScreenSpacePosition(new Position(Position.X + LeftOffset, Position.Y, Position.Height, Position.Height)), new Vector2f(0, 0), CalculateScreenSpaceHeight((int)(Position.Height * 0.4F)), TextPosition.Middle, TextPosition.Middle, this, Color.Black, Value.ToString()); }