/// <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; }
/// <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; }
/// <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; }
/// <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); }
/// <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); }