Skip to content

Commit

Permalink
Fix notes being pressed twice on keys
Browse files Browse the repository at this point in the history
  • Loading branch information
StavWasPlayZ committed Jul 20, 2023
1 parent b17965d commit 21585c8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) {
}
@Override
public boolean keyReleased(int pKeyCode, int pScanCode, int pModifiers) {
unlockFocused();
unlockFocused(pKeyCode);

final NoteButton note = getNoteByKey(pKeyCode);
if (note != null)
Expand All @@ -225,6 +225,7 @@ public NoteButton getNoteByKey(final int keyCode) {

return noteMap().containsKey(key) ? noteMap().get(key) : null;
}

/**
* Unlocks any focused {@link NoteButton}s
*/
Expand All @@ -235,6 +236,15 @@ private void unlockFocused() {
return;
}
}
/**
* Unlocks a {@link NoteButton} based on its corresponding key
*/
private void unlockFocused(final int keyCode) {
final NoteButton note = getNoteByKey(keyCode);

if (note != null)
note.locked = false;
}


//#region Making the options screen function
Expand Down

0 comments on commit 21585c8

Please sign in to comment.