public PCButton(Texture2D lButtonSprite, Rectangle lLocation) { mButtonSprite = lButtonSprite; mDrawRectange = new Rectangle(0, 0, lLocation.Width, lLocation.Height); mLocation = lLocation; mStartPoints = new Point[4]; mButtonState = PCButtonState.none; }
/// <summary> /// Set the positions of different button states /// </summary> /// <param name="lButtonState">The button state to define</param> /// <param name="position">The position of the button image in the sprite</param> public void ConfigureButton(PCButtonState lButtonState, Point position) { mStartPoints[(int)lButtonState] = position; }
public virtual void LeftMouseReleased() { mButtonState = PCButtonState.released; mDrawRectange.X = mStartPoints[(int)PCButtonState.released].X; mDrawRectange.Y = mStartPoints[(int)PCButtonState.released].Y; LeftMouseRelase(this, new EventArgs()); }
public virtual void LeftMouseDoubeClicked() { mButtonState = PCButtonState.pressed; mDrawRectange.X = mStartPoints[(int)PCButtonState.pressed].X; mDrawRectange.Y = mStartPoints[(int)PCButtonState.pressed].Y; LeftMouseDoubleClick(this, new EventArgs()); }
public virtual void MouseUnHovered() { mButtonState = PCButtonState.none; mDrawRectange.X = mStartPoints[(int)PCButtonState.none].X; mDrawRectange.Y = mStartPoints[(int)PCButtonState.none].Y; MouseUnHover(this, new EventArgs()); }