Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UKeyboard: Add KEY_NUMPADENTER and isEnterKey method #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions api/UniversalCraft.api
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ public final class gg/essential/universal/UKeyboard {
public static final field KEY_NUMPAD7 I
public static final field KEY_NUMPAD8 I
public static final field KEY_NUMPAD9 I
public static final field KEY_NUMPADENTER I
public static final field KEY_O I
public static final field KEY_P I
public static final field KEY_PERIOD I
Expand Down Expand Up @@ -460,6 +461,7 @@ public final class gg/essential/universal/UKeyboard {
public static final fun getModifiers ()Lgg/essential/universal/UKeyboard$Modifiers;
public static final fun isAltKeyDown ()Z
public static final fun isCtrlKeyDown ()Z
public static final fun isEnterKey (I)Z
public static final fun isKeyComboCtrlA (I)Z
public static final fun isKeyComboCtrlC (I)Z
public static final fun isKeyComboCtrlShiftZ (I)Z
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/gg/essential/universal/UKeyboard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ object UKeyboard {
//$$ @JvmField val KEY_NUMPAD7: Int = noInline { GLFW.GLFW_KEY_KP_7 }
//$$ @JvmField val KEY_NUMPAD8: Int = noInline { GLFW.GLFW_KEY_KP_8 }
//$$ @JvmField val KEY_NUMPAD9: Int = noInline { GLFW.GLFW_KEY_KP_9 }
//$$ @JvmField val KEY_NUMPADENTER: Int = noInline { GLFW.GLFW_KEY_KP_ENTER }
//$$ @JvmField val KEY_A: Int = noInline { GLFW.GLFW_KEY_A }
//$$ @JvmField val KEY_B: Int = noInline { GLFW.GLFW_KEY_B }
//$$ @JvmField val KEY_C: Int = noInline { GLFW.GLFW_KEY_C }
Expand Down Expand Up @@ -173,6 +174,7 @@ object UKeyboard {
@JvmField val KEY_NUMPAD7: Int = noInline { Keyboard.KEY_NUMPAD7 }
@JvmField val KEY_NUMPAD8: Int = noInline { Keyboard.KEY_NUMPAD8 }
@JvmField val KEY_NUMPAD9: Int = noInline { Keyboard.KEY_NUMPAD9 }
@JvmField val KEY_NUMPADENTER: Int = noInline { Keyboard.KEY_NUMPADENTER }
@JvmField val KEY_A: Int = noInline { Keyboard.KEY_A }
@JvmField val KEY_B: Int = noInline { Keyboard.KEY_B }
@JvmField val KEY_C: Int = noInline { Keyboard.KEY_C }
Expand Down Expand Up @@ -292,6 +294,9 @@ object UKeyboard {
@JvmStatic
fun isKeyComboCtrlShiftZ(key: Int): Boolean = key == KEY_Z && isCtrlKeyDown() && isShiftKeyDown() && !isAltKeyDown()

@JvmStatic
fun isEnterKey(key: Int) = key == KEY_ENTER || key == KEY_NUMPADENTER

@JvmStatic
fun isKeyDown(key: Int): Boolean {
if (key == KEY_NONE) return false
Expand Down
Loading