Combine Mouse and KeyInputEvent

This commit is contained in:
JeremyStar™ 2024-07-23 17:47:21 +02:00
parent 7b70cf8511
commit ec3ecc0113
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
5 changed files with 259 additions and 33 deletions

View file

@ -115,7 +115,7 @@ public final class GraphicsSubsystemConfiguration implements SubsystemConfigurat
/** /**
* If enabled, will make the Graphics API try to prevent tearing from happening. * If enabled, will make the Graphics API try to prevent tearing from happening.
* *
* @since v1-alph2 * @since v1-alpha2
* *
* -- GETTER -- * -- GETTER --
* Gets the value for {@link #disallowTearing}. * Gets the value for {@link #disallowTearing}.
@ -131,7 +131,7 @@ public final class GraphicsSubsystemConfiguration implements SubsystemConfigurat
* <p> * <p>
* Will have no effect if no integrated or discrete graphics card is installed in the system. * Will have no effect if no integrated or discrete graphics card is installed in the system.
* *
* @since v1-alph2 * @since v1-alpha2
* *
* -- GETTER -- * -- GETTER --
* Gets the value for {@link #disallowIntegratedGraphics}. * Gets the value for {@link #disallowIntegratedGraphics}.

View file

@ -17,25 +17,26 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.staropensource.sosengine.graphics.events.input; package de.staropensource.sosengine.graphics.events;
import de.staropensource.sosengine.base.classes.Event; import de.staropensource.sosengine.base.classes.Event;
import de.staropensource.sosengine.base.classes.helpers.EventHelper; import de.staropensource.sosengine.base.classes.helpers.EventHelper;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.types.input.Key; import de.staropensource.sosengine.graphics.types.input.Key;
import de.staropensource.sosengine.graphics.types.input.KeyState; import de.staropensource.sosengine.graphics.types.input.KeyState;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
* Called when a key is pressed. * Called when a key or button is pressed.
* *
* @since v1-alpha2 * @since v1-alpha2
*/ */
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public class KeyInputEvent implements Event { public class InputEvent implements Event {
/** /**
* {@inheritDoc} * {@inheritDoc}
* @see #callEvent(Key, KeyState) * @see #callEvent(Window, Key, KeyState)
* @deprecated use {@link #callEvent(Key, KeyState)} * @deprecated use {@link #callEvent(Window, Key, KeyState)}
*/ */
@Deprecated @Deprecated
@Override @Override
@ -46,7 +47,7 @@ public class KeyInputEvent implements Event {
* *
* @since v1-alpha0 * @since v1-alpha0
*/ */
public void callEvent(@NotNull Key key, @NotNull KeyState state) { public void callEvent(@NotNull Window window, @NotNull Key key, @NotNull KeyState state) {
EventHelper.invokeAnnotatedMethods(getClass(), key, state); EventHelper.invokeAnnotatedMethods(getClass(), window, key, state);
} }
} }

View file

@ -1,22 +0,0 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Contributors
* Licensed under the GNU Affero General Public License v3
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.events.input;
public class MouseInputEvent {}

View file

@ -27,466 +27,715 @@ package de.staropensource.sosengine.graphics.types.input;
*/ */
@SuppressWarnings({ "unused" }) @SuppressWarnings({ "unused" })
public enum Key { public enum Key {
/**
* The left mouse button.
*
* @since v1-alpha2
*/
MOUSE_LEFT,
/**
* The middle mouse button.
*
* @since v1-alpha2
*/
MOUSE_MIDDLE,
/**
* The right mouse button.
*
* @since v1-alpha2
*/
MOUSE_RIGHT,
/** /**
* The {@code ALT} modifier key. * The {@code ALT} modifier key.
*
* @since v1-alpha2
*/ */
ALT, ALT,
/** /**
* The {@code '} key. * The {@code '} key.
*
* @since v1-alpha2
*/ */
APOSTROPHE, APOSTROPHE,
/** /**
* The {@code DOWN} arrow key. * The {@code DOWN} arrow key.
*
* @since v1-alpha2
*/ */
ARROW_DOWN, ARROW_DOWN,
/** /**
* The {@code LEFT} arrow key. * The {@code LEFT} arrow key.
*
* @since v1-alpha2
*/ */
ARROW_LEFT, ARROW_LEFT,
/** /**
* The {@code RIGHT} arrow key. * The {@code RIGHT} arrow key.
*
* @since v1-alpha2
*/ */
ARROW_RIGHT, ARROW_RIGHT,
/** /**
* The {@code UP} arrow key. * The {@code UP} arrow key.
*
* @since v1-alpha2
*/ */
ARROW_UP, ARROW_UP,
/** /**
* The {@code \} key. * The {@code \} key.
*
* @since v1-alpha2
*/ */
BACKSLASH, BACKSLASH,
/** /**
* The {@code BACKSPACE} key. * The {@code BACKSPACE} key.
*
* @since v1-alpha2
*/ */
BACKSPACE, BACKSPACE,
/** /**
* The left {@code [} key. * The left {@code [} key.
*
* @since v1-alpha2
*/ */
BRACKET_LEFT, BRACKET_LEFT,
/** /**
* The right {@code ]} key. * The right {@code ]} key.
*
* @since v1-alpha2
*/ */
BRACKET_RIGHT, BRACKET_RIGHT,
/** /**
* THE {@code CAPSLOCK} KEY. * THE {@code CAPSLOCK} KEY.
*
* @since v1-alpha2
*/ */
CAPS_LOCK, CAPS_LOCK,
/** /**
* The {@code ,} key. * The {@code ,} key.
*
* @since v1-alpha2
*/ */
COMMA, COMMA,
/** /**
* The left {@code CTRL} modifier key. * The left {@code CTRL} modifier key.
*
* @since v1-alpha2
*/ */
CONTROL_LEFT, CONTROL_LEFT,
/** /**
* The right {@code CTRL} modifier key. * The right {@code CTRL} modifier key.
*
* @since v1-alpha2
*/ */
CONTROL_RIGHT, CONTROL_RIGHT,
/** /**
* The {@code DEL} key. * The {@code DEL} key.
*
* @since v1-alpha2
*/ */
DELETE, DELETE,
/** /**
* The {@code END} key. * The {@code END} key.
*
* @since v1-alpha2
*/ */
END, END,
/** /**
* The {@code ENTER} key. * The {@code ENTER} key.
*
* @since v1-alpha2
*/ */
ENTER, ENTER,
/** /**
* The {@code =} key. * The {@code =} key.
*
* @since v1-alpha2
*/ */
EQUAL, EQUAL,
/** /**
* The {@code ESC} key. * The {@code ESC} key.
*
* @since v1-alpha2
*/ */
ESCAPE, ESCAPE,
/** /**
* The {@code F1} key. * The {@code F1} key.
*
* @since v1-alpha2
*/ */
FUNCTION_1, FUNCTION_1,
/** /**
* The {@code F2} key. * The {@code F2} key.
*
* @since v1-alpha2
*/ */
FUNCTION_2, FUNCTION_2,
/** /**
* The {@code F3} key. * The {@code F3} key.
*
* @since v1-alpha2
*/ */
FUNCTION_3, FUNCTION_3,
/** /**
* The {@code F4} key. * The {@code F4} key.
*
* @since v1-alpha2
*/ */
FUNCTION_4, FUNCTION_4,
/** /**
* The {@code F5} key. * The {@code F5} key.
*
* @since v1-alpha2
*/ */
FUNCTION_5, FUNCTION_5,
/** /**
* The {@code F6} key. * The {@code F6} key.
*
* @since v1-alpha2
*/ */
FUNCTION_6, FUNCTION_6,
/** /**
* The {@code F7} key. * The {@code F7} key.
*
* @since v1-alpha2
*/ */
FUNCTION_7, FUNCTION_7,
/** /**
* The {@code F8} key. * The {@code F8} key.
*
* @since v1-alpha2
*/ */
FUNCTION_8, FUNCTION_8,
/** /**
* The {@code F9} key. * The {@code F9} key.
*
* @since v1-alpha2
*/ */
FUNCTION_9, FUNCTION_9,
/** /**
* The {@code F10} key. * The {@code F10} key.
*
* @since v1-alpha2
*/ */
FUNCTION_10, FUNCTION_10,
/** /**
* The {@code F11} key. * The {@code F11} key.
*
* @since v1-alpha2
*/ */
FUNCTION_11, FUNCTION_11,
/** /**
* The {@code F12} key. * The {@code F12} key.
*
* @since v1-alpha2
*/ */
FUNCTION_12, FUNCTION_12,
/** /**
* The {@code F13} key. * The {@code F13} key.
*
* @since v1-alpha2
*/ */
FUNCTION_13, FUNCTION_13,
/** /**
* The {@code F14} key. * The {@code F14} key.
*
* @since v1-alpha2
*/ */
FUNCTION_14, FUNCTION_14,
/** /**
* The {@code F15} key. * The {@code F15} key.
*
* @since v1-alpha2
*/ */
FUNCTION_15, FUNCTION_15,
/** /**
* The {@code F16} key. * The {@code F16} key.
*
* @since v1-alpha2
*/ */
FUNCTION_16, FUNCTION_16,
/** /**
* The {@code F17} key. * The {@code F17} key.
*
* @since v1-alpha2
*/ */
FUNCTION_17, FUNCTION_17,
/** /**
* The {@code F18} key. * The {@code F18} key.
*
* @since v1-alpha2
*/ */
FUNCTION_18, FUNCTION_18,
/** /**
* The {@code F19} key. * The {@code F19} key.
*
* @since v1-alpha2
*/ */
FUNCTION_19, FUNCTION_19,
/** /**
* The {@code F20} key. * The {@code F20} key.
*
* @since v1-alpha2
*/ */
FUNCTION_20, FUNCTION_20,
/** /**
* The {@code F21} key. * The {@code F21} key.
*
* @since v1-alpha2
*/ */
FUNCTION_21, FUNCTION_21,
/** /**
* The {@code F22} key. * The {@code F22} key.
*
* @since v1-alpha2
*/ */
FUNCTION_22, FUNCTION_22,
/** /**
* The {@code F23} key. * The {@code F23} key.
*
* @since v1-alpha2
*/ */
FUNCTION_23, FUNCTION_23,
/** /**
* The {@code F24} key. * The {@code F24} key.
*
* @since v1-alpha2
*/ */
FUNCTION_24, FUNCTION_24,
/** /**
* The {@code F25} key. * The {@code F25} key.
*
* @since v1-alpha2
*/ */
FUNCTION_25, FUNCTION_25,
/** /**
* The {@code `} key. * The {@code `} key.
*
* @since v1-alpha2
*/ */
GRAVE, GRAVE,
/** /**
* The {@code HOME} key. * The {@code HOME} key.
*
* @since v1-alpha2
*/ */
HOME, HOME,
/** /**
* THe {@code INS} key. * THe {@code INS} key.
*
* @since v1-alpha2
*/ */
INSERT, INSERT,
/** /**
* The {@code +} key on your keypad. * The {@code +} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_ADD, KEYPAD_ADD,
/** /**
* The {@code -} key on your keypad. * The {@code -} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_DECIMAL, KEYPAD_DECIMAL,
/** /**
* The {@code /} key on your keypad. * The {@code /} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_DIVIDE, KEYPAD_DIVIDE,
/** /**
* The {@code ENTER} key on your keypad. * The {@code ENTER} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_ENTER, KEYPAD_ENTER,
/** /**
* The {@code =} key on your keypad. * The {@code =} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_EQUAL, KEYPAD_EQUAL,
/** /**
* The {@code *} key on your keypad. * The {@code *} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_MULTIPLY, KEYPAD_MULTIPLY,
/** /**
* The number {@code 0} key on your keypad. * The number {@code 0} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_0, KEYPAD_NUMBER_0,
/** /**
* The number {@code 1} key on your keypad. * The number {@code 1} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_1, KEYPAD_NUMBER_1,
/** /**
* The number {@code 2} key on your keypad. * The number {@code 2} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_2, KEYPAD_NUMBER_2,
/** /**
* The number {@code 3} key on your keypad. * The number {@code 3} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_3, KEYPAD_NUMBER_3,
/** /**
* The number {@code 4} key on your keypad. * The number {@code 4} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_4, KEYPAD_NUMBER_4,
/** /**
* The number {@code 5} key on your keypad. * The number {@code 5} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_5, KEYPAD_NUMBER_5,
/** /**
* The number {@code 6} key on your keypad. * The number {@code 6} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_6, KEYPAD_NUMBER_6,
/** /**
* The number {@code 7} key on your keypad. * The number {@code 7} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_7, KEYPAD_NUMBER_7,
/** /**
* The number {@code 8} key on your keypad. * The number {@code 8} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_8, KEYPAD_NUMBER_8,
/** /**
* The number {@code 9} key on your keypad. * The number {@code 9} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_NUMBER_9, KEYPAD_NUMBER_9,
/** /**
* The {@code -} key on your keypad. * The {@code -} key on your keypad.
*
* @since v1-alpha2
*/ */
KEYPAD_SUBTRACT, KEYPAD_SUBTRACT,
/** /**
* The letter {@code A} key. * The letter {@code A} key.
*
* @since v1-alpha2
*/ */
LETTER_A, LETTER_A,
/** /**
* The letter {@code B} key. * The letter {@code B} key.
*
* @since v1-alpha2
*/ */
LETTER_B, LETTER_B,
/** /**
* The letter {@code C} key. * The letter {@code C} key.
*
* @since v1-alpha2
*/ */
LETTER_C, LETTER_C,
/** /**
* The letter {@code D} key. * The letter {@code D} key.
*
* @since v1-alpha2
*/ */
LETTER_D, LETTER_D,
/** /**
* The letter {@code E} key. * The letter {@code E} key.
*
* @since v1-alpha2
*/ */
LETTER_E, LETTER_E,
/** /**
* The letter {@code F} key. * The letter {@code F} key.
*
* @since v1-alpha2
*/ */
LETTER_F, LETTER_F,
/** /**
* The letter {@code G} key. * The letter {@code G} key.
*
* @since v1-alpha2
*/ */
LETTER_G, LETTER_G,
/** /**
* The letter {@code H} key. * The letter {@code H} key.
*
* @since v1-alpha2
*/ */
LETTER_H, LETTER_H,
/** /**
* The letter {@code I} key. * The letter {@code I} key.
*
* @since v1-alpha2
*/ */
LETTER_I, LETTER_I,
/** /**
* The letter {@code J} key. * The letter {@code J} key.
*
* @since v1-alpha2
*/ */
LETTER_J, LETTER_J,
/** /**
* The letter {@code K} key. * The letter {@code K} key.
*
* @since v1-alpha2
*/ */
LETTER_K, LETTER_K,
/** /**
* The letter {@code L} key. * The letter {@code L} key.
*
* @since v1-alpha2
*/ */
LETTER_L, LETTER_L,
/** /**
* The letter {@code M} key. * The letter {@code M} key.
*
* @since v1-alpha2
*/ */
LETTER_M, LETTER_M,
/** /**
* The letter {@code N} key. * The letter {@code N} key.
*
* @since v1-alpha2
*/ */
LETTER_N, LETTER_N,
/** /**
* The letter {@code O} key. * The letter {@code O} key.
*
* @since v1-alpha2
*/ */
LETTER_O, LETTER_O,
/** /**
* The letter {@code P} key. * The letter {@code P} key.
*
* @since v1-alpha2
*/ */
LETTER_P, LETTER_P,
/** /**
* The letter {@code Q} key. * The letter {@code Q} key.
*
* @since v1-alpha2
*/ */
LETTER_Q, LETTER_Q,
/** /**
* The letter {@code R} key. * The letter {@code R} key.
*
* @since v1-alpha2
*/ */
LETTER_R, LETTER_R,
/** /**
* The letter {@code S} key. * The letter {@code S} key.
*
* @since v1-alpha2
*/ */
LETTER_S, LETTER_S,
/** /**
* The letter {@code T} key. * The letter {@code T} key.
*
* @since v1-alpha2
*/ */
LETTER_T, LETTER_T,
/** /**
* The letter {@code U} key. * The letter {@code U} key.
*
* @since v1-alpha2
*/ */
LETTER_U, LETTER_U,
/** /**
* The letter {@code V} key. * The letter {@code V} key.
*
* @since v1-alpha2
*/ */
LETTER_V, LETTER_V,
/** /**
* The letter {@code W} key. * The letter {@code W} key.
*
* @since v1-alpha2
*/ */
LETTER_W, LETTER_W,
/** /**
* The letter {@code X} key. * The letter {@code X} key.
*
* @since v1-alpha2
*/ */
LETTER_X, LETTER_X,
/** /**
* The letter {@code Y} key. * The letter {@code Y} key.
*
* @since v1-alpha2
*/ */
LETTER_Y, LETTER_Y,
/** /**
* The letter {@code Z} key. * The letter {@code Z} key.
*
* @since v1-alpha2
*/ */
LETTER_Z, LETTER_Z,
/** /**
* The {@code MENU} key, which brings up the right click menu. * The {@code MENU} key, which brings up the right click menu.
*
* @since v1-alpha2
*/ */
MENU, MENU,
/** /**
* The {@code META} key, also known as the {@code SUPER} key. * The {@code META} key, also known as the {@code SUPER} key.
* <p> * <p>
* Windows users will recognize this key as the Windows key. * Windows users will recognize this key as the Windows key.
*
* @since v1-alpha2
*/ */
META, META,
/** /**
* The {@code -} key. * The {@code -} key.
*
* @since v1-alpha2
*/ */
MINUS, MINUS,
/** /**
* The number {@code 0}. * The number {@code 0}.
*
* @since v1-alpha2
*/ */
NUMBER_0, NUMBER_0,
/** /**
* The number {@code 1}. * The number {@code 1}.
*
* @since v1-alpha2
*/ */
NUMBER_1, NUMBER_1,
/** /**
* The number {@code 2}. * The number {@code 2}.
*
* @since v1-alpha2
*/ */
NUMBER_2, NUMBER_2,
/** /**
* The number {@code 3}. * The number {@code 3}.
*
* @since v1-alpha2
*/ */
NUMBER_3, NUMBER_3,
/** /**
* The number {@code 4}. * The number {@code 4}.
*
* @since v1-alpha2
*/ */
NUMBER_4, NUMBER_4,
/** /**
* The number {@code 5}. * The number {@code 5}.
*
* @since v1-alpha2
*/ */
NUMBER_5, NUMBER_5,
/** /**
* The number {@code 6}. * The number {@code 6}.
*
* @since v1-alpha2
*/ */
NUMBER_6, NUMBER_6,
/** /**
* The number {@code 7}. * The number {@code 7}.
*
* @since v1-alpha2
*/ */
NUMBER_7, NUMBER_7,
/** /**
* The number {@code 8}. * The number {@code 8}.
*
* @since v1-alpha2
*/ */
NUMBER_8, NUMBER_8,
/** /**
* The number {@code 9}. * The number {@code 9}.
*
* @since v1-alpha2
*/ */
NUMBER_9, NUMBER_9,
/** /**
* The {@code NUM} key. * The {@code NUM} key.
*
* @since v1-alpha2
*/ */
NUM_LOCK, NUM_LOCK,
/** /**
* The {@code PAGE DOWN} key. * The {@code PAGE DOWN} key.
*
* @since v1-alpha2
*/ */
PAGE_DOWN, PAGE_DOWN,
/** /**
* The {@code PAGE UP} key. * The {@code PAGE UP} key.
*
* @since v1-alpha2
*/ */
PAGE_UP, PAGE_UP,
/** /**
* The {@code PAUSE} key. * The {@code PAUSE} key.
*
* @since v1-alpha2
*/ */
PAUSE, PAUSE,
/** /**
* The {@code .} key. * The {@code .} key.
*
* @since v1-alpha2
*/ */
PERIOD, PERIOD,
/** /**
* The {@code PRINT} key. * The {@code PRINT} key.
*
* @since v1-alpha2
*/ */
PRINT, PRINT,
/** /**
* The {@code SCROLL} key. * The {@code SCROLL} key.
*
* @since v1-alpha2
*/ */
SCROLL_LOCK, SCROLL_LOCK,
/** /**
* The {@code ;} key. * The {@code ;} key.
*
* @since v1-alpha2
*/ */
SEMICOLON, SEMICOLON,
/** /**
* The left {@code SHIFT} modifier key. * The left {@code SHIFT} modifier key.
*
* @since v1-alpha2
*/ */
SHIFT_LEFT, SHIFT_LEFT,
/** /**
* The right {@code SHIFT} modifier key. * The right {@code SHIFT} modifier key.
*
* @since v1-alpha2
*/ */
SHIFT_RIGHT, SHIFT_RIGHT,
/** /**
* The {@code /} key. * The {@code /} key.
*
* @since v1-alpha2
*/ */
SLASH, SLASH,
/** /**
* The {@code TAB} key. * The {@code TAB} key.
*
* @since v1-alpha2
*/ */
TAB, TAB,
} }

View file

@ -15,7 +15,6 @@ module sosengine.graphics {
exports de.staropensource.sosengine.graphics; exports de.staropensource.sosengine.graphics;
exports de.staropensource.sosengine.graphics.classes; exports de.staropensource.sosengine.graphics.classes;
exports de.staropensource.sosengine.graphics.events; exports de.staropensource.sosengine.graphics.events;
exports de.staropensource.sosengine.graphics.events.input;
exports de.staropensource.sosengine.graphics.types.input; exports de.staropensource.sosengine.graphics.types.input;
exports de.staropensource.sosengine.graphics.types.window; exports de.staropensource.sosengine.graphics.types.window;
@ -23,7 +22,6 @@ module sosengine.graphics {
opens de.staropensource.sosengine.graphics; opens de.staropensource.sosengine.graphics;
opens de.staropensource.sosengine.graphics.classes; opens de.staropensource.sosengine.graphics.classes;
opens de.staropensource.sosengine.graphics.events; opens de.staropensource.sosengine.graphics.events;
opens de.staropensource.sosengine.graphics.events.input;
opens de.staropensource.sosengine.graphics.types.input; opens de.staropensource.sosengine.graphics.types.input;
opens de.staropensource.sosengine.graphics.types.window; opens de.staropensource.sosengine.graphics.types.window;
} }