Add UNKNOWN_MOUSE, rename UNKNOWN -> UNKNOWN_KEY

This commit is contained in:
JeremyStar™ 2024-07-25 12:19:32 +02:00
parent be144fb71b
commit 6dc0566fed
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
4 changed files with 14 additions and 4 deletions

View file

@ -170,7 +170,7 @@ public class EventHelper {
if (EngineConfiguration.getInstance().isOptimizeEvents()) if (EngineConfiguration.getInstance().isOptimizeEvents())
Thread Thread
.ofVirtual() .ofVirtual()
.name("Event " + event.getName() + "[" + arguments + "]") .name("Event " + event.getName())
.start(eventCode); .start(eventCode);
else else
eventCode.run(); eventCode.run();

View file

@ -31,6 +31,8 @@ import static org.lwjgl.glfw.GLFW.*;
/** /**
* A {@link GLFWKeyCallbackI} implementation. * A {@link GLFWKeyCallbackI} implementation.
*
* @since v1-alpha2
*/ */
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public class KeyCallback extends WindowCallback implements GLFWKeyCallbackI { public class KeyCallback extends WindowCallback implements GLFWKeyCallbackI {
@ -65,7 +67,7 @@ public class KeyCallback extends WindowCallback implements GLFWKeyCallbackI {
getAttachedWindow(), getAttachedWindow(),
// Key // Key
switch (key) { switch (key) {
case GLFW_KEY_UNKNOWN -> Key.UNKNOWN; case GLFW_KEY_UNKNOWN -> Key.UNKNOWN_KEY;
case GLFW_KEY_LEFT_ALT, GLFW_KEY_RIGHT_ALT -> Key.ALT; case GLFW_KEY_LEFT_ALT, GLFW_KEY_RIGHT_ALT -> Key.ALT;
case GLFW_KEY_APOSTROPHE -> Key.APOSTROPHE; case GLFW_KEY_APOSTROPHE -> Key.APOSTROPHE;
case GLFW_KEY_DOWN -> Key.ARROW_DOWN; case GLFW_KEY_DOWN -> Key.ARROW_DOWN;

View file

@ -157,8 +157,10 @@ public abstract class GlfwWindow extends Window {
// Set swap interval based on isDisallowTearing setting // Set swap interval based on isDisallowTearing setting
glfwSwapInterval(Miscellaneous.getIntegerizedBoolean(GraphicsSubsystemConfiguration.getInstance().isDisallowTearing())); glfwSwapInterval(Miscellaneous.getIntegerizedBoolean(GraphicsSubsystemConfiguration.getInstance().isDisallowTearing()));
// Set callbacks // Create callbacks
keyCallback = GLFWKeyCallback.create(new KeyCallback(this)); keyCallback = GLFWKeyCallback.create(new KeyCallback(this));
// Set callback
glfwSetKeyCallback(identifierLong, keyCallback); glfwSetKeyCallback(identifierLong, keyCallback);
// Update the window state // Update the window state

View file

@ -32,7 +32,13 @@ public enum Key {
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
UNKNOWN, UNKNOWN_KEY,
/**
* An unknown mouse button.
*
* @since v1-alpha2
*/
UNKNOWN_MOUSE,
/** /**
* The left mouse button. * The left mouse button.