public bool Update(GameTime gameTime, int mx, int my, bool mpressed, bool prev_mpressed)
{
frameTimer = gameTime.ElapsedGameTime.Milliseconds / 1000.0;
if (hitImageAlpha(buttonRectangle, buttonTexture, mx, my))
{
timer = 0.0;
if (mpressed)
{
// mouse is currently down
bState = BState.DOWN;
buttonColor = Color.LightSkyBlue;
}
else if (!mpressed && prev_mpressed)
{
// mouse was just released
if (bState == BState.DOWN)
{
// button i was just down
bState = BState.RELEASED;
}
}
else
{
bState = BState.HOVER;
buttonColor = Color.LightBlue;
}
}
else
{
bState = BState.UP;
if (timer > 0)
{
timer = timer - frameTimer;
}
else
{
buttonColor = Color.White;
}
}
if (bState == BState.RELEASED)
{
return true;
}
return false;
}