Example #1
0
        public IconButton(Position position, Gamestate gamestate, Texture iconTexture, float scale, Color iconColor) : base(position, gamestate)
        {
            IconTexture = iconTexture;
            Scale       = scale;

            Background = new RenderRoundedRectangle(new Position(), this, Color.White, new Color(120, 160, 255), CalculateScreenSpaceHeight(5), CalculateScreenSpaceHeight(20));
            Icon       = new RenderSymbol(new Position(), this, iconTexture, iconColor);

            RecalculateComponentsPositions();
        }
        public SelectPlayerButton(Position position, Gamestate gamestate, PlayersManager playersManager, int playerId, ScreenType screenType) : base(position, gamestate)
        {
            PlayersManager = playersManager;
            PlayerId       = playerId;
            Screen         = screenType;

            PlayerRectangle = new RenderRoundedRectangle(new Position(), this, Color.White, new Color(120, 160, 255), CalculateScreenSpaceHeight(5), CalculateScreenSpaceHeight(20));

            RecalculateComponentsPositions();
        }
Example #3
0
        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;
        }
Example #4
0
        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();
        }
Example #5
0
 public Frame(Gamestate gamestate) : base(new Position(0, 0, 1000, 1000), gamestate)
 {
     FrameRectangle = new RenderRoundedRectangle(new Position(), this, new Color(245, 245, 245), new Color(120, 160, 255), CalculateScreenSpaceHeight(10), CalculateScreenSpaceHeight(20));
     RecalculateComponentsPositions();
 }