Package me.hackware.api.setting.impl
Class KeybindSetting
A setting that stores a keybind (GLFW key code) and its activation mode.
The value is the GLFW key code (GLFW.GLFW_KEY_UNKNOWN = unbound).
The mode determines whether the keybind toggles the module or activates it
only while held.
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionKeybindSetting(String name) KeybindSetting(String name, int defaultKey) KeybindSetting(String name, String description) KeybindSetting(String name, String description, int defaultKey) -
Method Summary
Modifier and TypeMethodDescriptionvoiddefaultValue(Integer defaultValue) description(String description) displayName(String displayName) static intfromMouseButton(int button) Encodes a GLFW mouse button (0–7) into the internal code.Returns a human-readable name for the bound key / mouse button, or "..." if unbound.getMode()booleanisBound()booleanisDown(long windowHandle) Polls the current state of this keybind (keyboard key or mouse button).static booleanisMouseButton(int code) Returnstrueif the stored code represents a mouse button.static StringkeyCodeToGlfwName(int keyCode) Returns the GLFW constant name for a key code (e.g.static intkeyNameToCode(String name) Resolves a key name string (as produced bygetKeyName()) back to a GLFW key code.static StringnameForCode(int key) Human-readable name for any key / mouse-button code, asgetKeyName()produces.voidvoidsetWasDown(boolean wasDown) static inttoMouseButton(int code) Decodes the internal code back to a GLFW mouse button (0–7).voidunbind()visible(boolean visible) visible(BooleanSupplier visible) booleanwasDown()Methods inherited from class me.hackware.api.setting.Setting
get, getDefaultValue, getDescription, getDisplayName, getGroup, getName, getOwner, isBulkLoading, isVisible, onChanged, setBulkLoadProbe, setOwner, setValue
-
Constructor Details
-
KeybindSetting
-
KeybindSetting
-
KeybindSetting
-
KeybindSetting
-
-
Method Details
-
isMouseButton
public static boolean isMouseButton(int code) Returnstrueif the stored code represents a mouse button. -
fromMouseButton
public static int fromMouseButton(int button) Encodes a GLFW mouse button (0–7) into the internal code. -
toMouseButton
public static int toMouseButton(int code) Decodes the internal code back to a GLFW mouse button (0–7). -
mode
-
displayName
- Overrides:
displayNamein classSetting<Integer>
-
defaultValue
- Overrides:
defaultValuein classSetting<Integer>
-
description
- Overrides:
descriptionin classSetting<Integer>
-
group
-
visible
-
visible
-
getMode
-
setMode
-
isBound
public boolean isBound() -
unbind
public void unbind() -
wasDown
public boolean wasDown() -
setWasDown
public void setWasDown(boolean wasDown) -
cycleMode
public void cycleMode() -
getKeyName
Returns a human-readable name for the bound key / mouse button, or "..." if unbound. -
nameForCode
Human-readable name for any key / mouse-button code, asgetKeyName()produces. -
keyNameToCode
Resolves a key name string (as produced bygetKeyName()) back to a GLFW key code. ReturnsGLFW.GLFW_KEY_UNKNOWNif the name is unrecognised. -
keyCodeToGlfwName
Returns the GLFW constant name for a key code (e.g."GLFW_KEY_L"). Falls back to"GLFW_KEY_UNKNOWN"for unmapped codes. -
isDown
public boolean isDown(long windowHandle) Polls the current state of this keybind (keyboard key or mouse button). Returnstrueif the bound input is currently pressed.
-