void PromptButton::Update(int delta) { if (isEnabled) { isClicked = false; isMouseDown = false; isMouseOver = false; RectangleWH positionRect = RectangleWH(position.GetX(), position.GetY(), pTextFont->GetWidth(text), pTextFont->GetHeight(text)); bool isPressed = MouseHelper::PressedAndHeldAnywhere() || MouseHelper::DoublePressedAndHeldAnywhere(); if (MouseHelper::ClickedOnRect(positionRect)) { playSound(GetClickSoundEffect()); isClicked = true; return; } if (MouseHelper::MouseDownOnRect(positionRect) && !isPressed) { isMouseDown = true; } else if (MouseHelper::MouseOverRect(positionRect) && !isPressed) { isMouseOver = true; } } }
void Button::OnClicked() { EventProviders::GetButtonEventProvider()->RaiseButtonClicked(this, id); playSound(GetClickSoundEffect()); }