Only play GUI sound when mouse hovers over a button.

This commit is contained in:
Steve 2015-11-26 17:41:43 +00:00
parent b63e2d66fe
commit a278f3554b
1 changed files with 5 additions and 2 deletions

View File

@ -96,11 +96,14 @@ void drawWidgets(const char *group)
{
if (!mouseOver)
{
mouseOver = (w->enabled && collision(w->rect.x, w->rect.y, w->rect.w, w->rect.h, app.mouse.x, app.mouse.y, 1, 1));
mouseOver = (w->type != WT_SELECT && w->enabled && collision(w->rect.x, w->rect.y, w->rect.w, w->rect.h, app.mouse.x, app.mouse.y, 1, 1));
if (mouseOver && selectedWidget != w)
{
playSound(SND_GUI_CLICK);
if (w->type == WT_BUTTON)
{
playSound(SND_GUI_CLICK);
}
selectedWidget = w;
}
}