Keystrokes mouse and space options
This commit is contained in:
@@ -10,11 +10,16 @@ import org.saturnclient.modules.ModuleDetails;
|
|||||||
|
|
||||||
public class Keystrokes extends Module implements HudMod {
|
public class Keystrokes extends Module implements HudMod {
|
||||||
public static Property<Boolean> enabled = Property.bool(false);
|
public static Property<Boolean> enabled = Property.bool(false);
|
||||||
public static ModDimensions dimensions = new ModDimensions(78, 52);
|
public static Property<Boolean> showMouse = Property.bool(true);
|
||||||
|
public static Property<Boolean> showSpace = Property.bool(false);
|
||||||
|
public static ModDimensions dimensions = new ModDimensions(78, 46);
|
||||||
private boolean w = false;
|
private boolean w = false;
|
||||||
private boolean a = false;
|
private boolean a = false;
|
||||||
private boolean s = false;
|
private boolean s = false;
|
||||||
private boolean d = false;
|
private boolean d = false;
|
||||||
|
private boolean lmb = false;
|
||||||
|
private boolean rmb = false;
|
||||||
|
private boolean space = false;
|
||||||
|
|
||||||
private static Property<Integer> clickBg = Property.color(0xFFCCCCCC);
|
private static Property<Integer> clickBg = Property.color(0xFFCCCCCC);
|
||||||
private static Property<Integer> clickFg = Property.color(0xFFFFFFFF);
|
private static Property<Integer> clickFg = Property.color(0xFFFFFFFF);
|
||||||
@@ -26,7 +31,11 @@ public class Keystrokes extends Module implements HudMod {
|
|||||||
.tags("Utility"),
|
.tags("Utility"),
|
||||||
|
|
||||||
enabled.named("Enabled"),
|
enabled.named("Enabled"),
|
||||||
dimensions.prop());
|
showMouse.named("Show mouse clicks"),
|
||||||
|
showSpace.named("Show space clicks"),
|
||||||
|
dimensions.prop(),
|
||||||
|
clickFg.named("Clicked fg"),
|
||||||
|
clickBg.named("Clicked bg"));
|
||||||
|
|
||||||
dimensions.renderBackground = false;
|
dimensions.renderBackground = false;
|
||||||
}
|
}
|
||||||
@@ -37,26 +46,79 @@ public class Keystrokes extends Module implements HudMod {
|
|||||||
a = SaturnClient.client.options.leftKey.isPressed();
|
a = SaturnClient.client.options.leftKey.isPressed();
|
||||||
s = SaturnClient.client.options.backKey.isPressed();
|
s = SaturnClient.client.options.backKey.isPressed();
|
||||||
d = SaturnClient.client.options.rightKey.isPressed();
|
d = SaturnClient.client.options.rightKey.isPressed();
|
||||||
}
|
lmb = SaturnClient.client.options.attackKey.isPressed();
|
||||||
|
rmb = SaturnClient.client.options.useKey.isPressed();
|
||||||
@Override
|
space = SaturnClient.client.options.jumpKey.isPressed();
|
||||||
public void renderHud(RenderScope scope) {
|
|
||||||
renderKey(scope, w, 'W', (dimensions.width - 24) / 2, 0);
|
|
||||||
renderKey(scope, a, 'A', 0, dimensions.height - 24);
|
|
||||||
renderKey(scope, s, 'S', (dimensions.width - 24) / 2, dimensions.height - 24);
|
|
||||||
renderKey(scope, d, 'D', dimensions.width - 24, dimensions.height - 24);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderDummy(RenderScope scope) {
|
public void renderDummy(RenderScope scope) {
|
||||||
renderKey(scope, false, 'W', (dimensions.width - 24) / 2, 0);
|
dimensions.height = 54; // base height with padding considered
|
||||||
renderKey(scope, false, 'A', 0, dimensions.height - 24);
|
|
||||||
renderKey(scope, false, 'S', (dimensions.width - 24) / 2, dimensions.height - 24);
|
// WASD keys (3px padding between each key)
|
||||||
renderKey(scope, false, 'D', dimensions.width - 24, dimensions.height - 24);
|
renderKey(scope, true, 'W', 27, 0); // Top center
|
||||||
|
renderKey(scope, false, 'A', 0, 27); // Bottom left
|
||||||
|
renderKey(scope, false, 'S', 27, 27); // Bottom center
|
||||||
|
renderKey(scope, false, 'D', 54, 27); // Bottom right
|
||||||
|
|
||||||
|
if (showMouse.value) {
|
||||||
|
renderKeyM(scope, true, "LMB", 0, 54); // Below A/S/D
|
||||||
|
renderKeyM(scope, false, "RMB", 40, 54); // With 3px between
|
||||||
|
dimensions.height += 27;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showSpace.value) {
|
||||||
|
renderKeySpace(scope, false, 0, dimensions.height);
|
||||||
|
dimensions.height += 22;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderHud(RenderScope scope) {
|
||||||
|
dimensions.height = 54; // base height with padding considered
|
||||||
|
|
||||||
|
// WASD keys (3px padding between each key)
|
||||||
|
renderKey(scope, w, 'W', 27, 0); // Top center
|
||||||
|
renderKey(scope, a, 'A', 0, 27); // Bottom left
|
||||||
|
renderKey(scope, s, 'S', 27, 27); // Bottom center
|
||||||
|
renderKey(scope, d, 'D', 54, 27); // Bottom right
|
||||||
|
|
||||||
|
if (showMouse.value) {
|
||||||
|
renderKeyM(scope, lmb, "LMB", 0, 54); // Below A/S/D
|
||||||
|
renderKeyM(scope, rmb, "RMB", 40, 54); // With 3px between
|
||||||
|
dimensions.height += 27;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showSpace.value) {
|
||||||
|
renderKeySpace(scope, space, 0, dimensions.height);
|
||||||
|
dimensions.height += 22;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Consistent 3px padding applied below:
|
||||||
|
|
||||||
|
private void renderKeySpace(RenderScope scope, boolean isPressed, int x, int y) {
|
||||||
|
int height = 19;
|
||||||
|
scope.drawRoundedRectangle(x, y, dimensions.width, height, dimensions.radius.value, isPressed ? clickBg.value : dimensions.bgColor.value);
|
||||||
|
|
||||||
|
// A 30-pixel line centered vertically with 3px top padding
|
||||||
|
int lineY = y + (height - 1) / 2;
|
||||||
|
scope.drawRect(x + (dimensions.width - 30) / 2, lineY, 30, 1, isPressed ? clickFg.value : dimensions.fgColor.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderKeyM(RenderScope scope, boolean isPressed, String c, int x, int y) {
|
||||||
|
int width = 38, height = 24;
|
||||||
|
scope.drawRoundedRectangle(x, y, width, height, dimensions.radius.value, isPressed ? clickBg.value : dimensions.bgColor.value);
|
||||||
|
|
||||||
|
// Apply padding: 3px top and left -> add slight offset to x/y
|
||||||
|
scope.drawText(0.6f, c, x + 9, y + 7, dimensions.font.value, isPressed ? clickFg.value : dimensions.fgColor.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderKey(RenderScope scope, boolean isPressed, char c, int x, int y) {
|
private void renderKey(RenderScope scope, boolean isPressed, char c, int x, int y) {
|
||||||
scope.drawRoundedRectangle(x, y, 24, 24, dimensions.radius.value, isPressed ? clickBg.value : dimensions.bgColor.value);
|
int size = 24;
|
||||||
|
scope.drawRoundedRectangle(x, y, size, size, dimensions.radius.value, isPressed ? clickBg.value : dimensions.bgColor.value);
|
||||||
|
|
||||||
|
// Center the character with 3px top padding
|
||||||
scope.drawText(0.6f, String.valueOf(c), x + 9, y + 7, dimensions.font.value, isPressed ? clickFg.value : dimensions.fgColor.value);
|
scope.drawText(0.6f, String.valueOf(c), x + 9, y + 7, dimensions.font.value, isPressed ? clickFg.value : dimensions.fgColor.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user