Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Add a sneak/Shift key indicator to KeystrokeHud #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void setKeystrokes() {
keystrokes.add(createFromKey(new Rectangle(36, 18, 17, 17), pos, client.options.rightKey));

// Space
keystrokes.add(new Keystroke(new Rectangle(0, 54, 53, 7), pos, client.options.jumpKey, (stroke, matrices) -> {
keystrokes.add(new Keystroke(new Rectangle(18, 54, 35, 7), pos, client.options.jumpKey, (stroke, matrices) -> {
Rectangle bounds = stroke.bounds;
Rectangle spaceBounds = new Rectangle(bounds.x() + stroke.offset.x() + 4,
bounds.y() + stroke.offset.y() + 2,
Expand All @@ -73,6 +73,26 @@ public void setKeystrokes() {
new Color((stroke.getFGColor().color() & 16579836) >> 2 | stroke.getFGColor().color() & -16777216));
}
}));

// Shift
keystrokes.add(new Keystroke(new Rectangle(0, 54, 17, 7), pos, client.options.sneakKey, (stroke, matrices) -> {
Rectangle bounds = stroke.bounds;
Rectangle arrowHeadBounds = new Rectangle(bounds.x() + stroke.offset.x() + 1,
bounds.y() + stroke.offset.y() + 2,
3, 1);
Rectangle arrowBodyBounds = new Rectangle(bounds.x() + stroke.offset.x() + 2,
bounds.y() + stroke.offset.y() + 1,
1, 4);
if (shadow.getBooleanValue()) {
fillRect(matrices, arrowHeadBounds.offset(1, 1),
new Color((stroke.getFGColor().color() & 16579836) >> 2 | stroke.getFGColor().color() & -16777216));
fillRect(matrices, arrowBodyBounds.offset(1, 1),
new Color((stroke.getFGColor().color() & 16579836) >> 2 | stroke.getFGColor().color() & -16777216));
}
fillRect(matrices, arrowHeadBounds, stroke.getFGColor());
fillRect(matrices, arrowBodyBounds, stroke.getFGColor());
}));

KeyBinding.unpressAll();
KeyBinding.updatePressedStates();
}
Expand Down