forked from StarOpenSource/Engine
Add UNKNOWN_MOUSE, rename UNKNOWN -> UNKNOWN_KEY
This commit is contained in:
parent
be144fb71b
commit
6dc0566fed
4 changed files with 14 additions and 4 deletions
|
@ -170,7 +170,7 @@ public class EventHelper {
|
|||
if (EngineConfiguration.getInstance().isOptimizeEvents())
|
||||
Thread
|
||||
.ofVirtual()
|
||||
.name("Event " + event.getName() + "[" + arguments + "]")
|
||||
.name("Event " + event.getName())
|
||||
.start(eventCode);
|
||||
else
|
||||
eventCode.run();
|
||||
|
|
|
@ -31,6 +31,8 @@ import static org.lwjgl.glfw.GLFW.*;
|
|||
|
||||
/**
|
||||
* A {@link GLFWKeyCallbackI} implementation.
|
||||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public class KeyCallback extends WindowCallback implements GLFWKeyCallbackI {
|
||||
|
@ -65,7 +67,7 @@ public class KeyCallback extends WindowCallback implements GLFWKeyCallbackI {
|
|||
getAttachedWindow(),
|
||||
// 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_APOSTROPHE -> Key.APOSTROPHE;
|
||||
case GLFW_KEY_DOWN -> Key.ARROW_DOWN;
|
||||
|
|
|
@ -157,8 +157,10 @@ public abstract class GlfwWindow extends Window {
|
|||
// Set swap interval based on isDisallowTearing setting
|
||||
glfwSwapInterval(Miscellaneous.getIntegerizedBoolean(GraphicsSubsystemConfiguration.getInstance().isDisallowTearing()));
|
||||
|
||||
// Set callbacks
|
||||
// Create callbacks
|
||||
keyCallback = GLFWKeyCallback.create(new KeyCallback(this));
|
||||
|
||||
// Set callback
|
||||
glfwSetKeyCallback(identifierLong, keyCallback);
|
||||
|
||||
// Update the window state
|
||||
|
|
|
@ -32,7 +32,13 @@ public enum Key {
|
|||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
UNKNOWN,
|
||||
UNKNOWN_KEY,
|
||||
/**
|
||||
* An unknown mouse button.
|
||||
*
|
||||
* @since v1-alpha2
|
||||
*/
|
||||
UNKNOWN_MOUSE,
|
||||
|
||||
/**
|
||||
* The left mouse button.
|
||||
|
|
Loading…
Reference in a new issue