Skip to content

Commit

Permalink
Add audio to TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
Zorbn committed Jun 9, 2023
1 parent 0397287 commit 0608448
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GraveZone/TextInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ public void Draw(GraveZone game)

public void UpdateFocusWithClick(int x, int y, GraveZone game)
{
var wasFocused = _isFocused;
var anchoredRectangle = game.Ui.AnchorRectangle(_rectangle, _uiAnchor);
_isFocused = anchoredRectangle.Contains(x, y);

if (_isFocused && !wasFocused)
game.Audio.PlaySoundWithPitch(Sound.Click);
}

public string GetTextString()
Expand Down

0 comments on commit 0608448

Please sign in to comment.