Example #1
0
        public ImageButton(Texture2D texture, ButtonStates buttonStates)
        {
            this.texture = texture;
            this.buttonStates = buttonStates;
            this.buttonStates.Validate();

            Opacity = 1.0f;

            Initialize();
        }
Example #2
0
        private ImageButton GetMenuOption(int row)
        {
            var optionWidth = 175;
            var optionHeight = 29;
            int offsetY = 0;
            ButtonCommand buttonCommand;

            switch (row)
            {
                case 1:
                    buttonCommand = ButtonCommand.Return;
                    offsetY = 58;
                    break;

                default:
                    buttonCommand = ButtonCommand.Connect;
                    break;
            }

            var buttonStates = new ButtonStates();
            buttonStates.Default = new Rectangle(0, offsetY, optionWidth, optionHeight);
            buttonStates.Highlighted = new Rectangle(176, offsetY, optionWidth, optionHeight);
            buttonStates.Focused = new Rectangle(352, offsetY, optionWidth, optionHeight);
            buttonStates.Pressed = buttonStates.Default;

            var result = new ImageButton(Context.Resources.Textures["MainMenu.JoinGameOptions"], buttonStates);
            result.HorizontalAlignment = HorizontalAlignment.Left;
            result.VerticalAlignment = VerticalAlignment.Top;
            result.Click += MenuOptionOnClick;
            result.Tag = buttonCommand;

            return result;
        }