示例#1
0
        /// <summary>
        ///
        /// Constructor of GUIButton
        /// </summary>
        /// <param name="callbackEvent">Function that will be called when button is pressed</param>
        public GUIButton(Texture2D normal, Texture2D hover, Texture2D pressed, Texture2D disabled, ButtonPressedCallback callbackEvent, GUIButtonState startState, Rectangle rect)
            : base(rect)
        {
            this.normalTexture   = normal;
            this.hoverTexture    = hover;
            this.pressedTexture  = pressed;
            this.disabledTexture = disabled;

            this.myState = startState;

            switch (this.myState)
            {
            case GUIButtonState.DISABLED:
                this.currentTexture = this.disabledTexture;
                break;

            case GUIButtonState.HOVER:
                this.currentTexture = this.hoverTexture;
                break;

            case GUIButtonState.NORMAL:
                this.currentTexture = this.normalTexture;
                break;

            case GUIButtonState.PRESSED:
                this.currentTexture = this.pressedTexture;
                break;
            }

            this.callbackEvent += callbackEvent;
        }
示例#2
0
        /// <summary>
        ///
        /// Constructor of GUIButton
        /// </summary>
        /// <param name="callbackEvent">Function that will be called when button is pressed</param>
        public GUIButton(Texture2D normal, Texture2D hover, Texture2D pressed, Texture2D disabled, ButtonPressedCallback callbackEvent, Rectangle rect)
            : base(rect)
        {
            this.normalTexture   = normal;
            this.hoverTexture    = hover;
            this.pressedTexture  = pressed;
            this.disabledTexture = disabled;

            this.currentTexture = this.normalTexture;

            this.callbackEvent += callbackEvent;
        }
示例#3
0
        /// <summary>
        ///
        /// Constructor of GUIButton
        /// </summary>
        /// <param name="callbackEvent">Function that will be called when button is pressed</param>
        public GUIButton(Texture2D normal, Texture2D hover, Texture2D pressed, Texture2D disabled, ButtonPressedCallback callbackEvent, Vector2 position, float width, float height)
            : base(position, width, height)
        {
            this.normalTexture   = normal;
            this.hoverTexture    = hover;
            this.pressedTexture  = pressed;
            this.disabledTexture = disabled;

            this.currentTexture = this.normalTexture;

            this.callbackEvent += callbackEvent;
        }
示例#4
0
        /// <summary>
        ///
        /// Draws GUIButton with passed parameters
        /// </summary>
        /// <param name="callbackEvent">Function that will be called when button is pressed</param>
        public void DrawButton(Texture2D normalTexture, Texture2D hoverTexture, Texture2D pressedTexture, Texture2D disabledTexture, GUIButtonState startState, ButtonPressedCallback callbackEvent, Rectangle rect)
        {
            GUIButton guiButton = new GUIButton(normalTexture, hoverTexture, pressedTexture, disabledTexture, callbackEvent, startState, rect);

            this.DrawButton(guiButton);
        }
示例#5
0
        /// <summary>
        ///
        /// Draws GUIButton with passed parameters
        /// </summary>
        /// <param name="callbackEvent">Function that will be called when button is pressed</param>
        public void DrawButton(Texture2D normalTexture, Texture2D hoverTexture, Texture2D pressedTexture, Texture2D disabledTexture, GUIButtonState startState, ButtonPressedCallback callbackEvent, Vector2 position, float width, float height)
        {
            GUIButton guiButton = new GUIButton(normalTexture, hoverTexture, pressedTexture, disabledTexture, callbackEvent, startState, position, width, height);

            this.DrawButton(guiButton);
        }