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.
*
* @since v1-alph2
* @since v1-alpha2
*
* -- GETTER --
* Gets the value for {@link #disallowTearing}.
@ -131,7 +131,7 @@ public final class GraphicsSubsystemConfiguration implements SubsystemConfigurat
* <p>
* Will have no effect if no integrated or discrete graphics card is installed in the system.
*
* @since v1-alph2
* @since v1-alpha2
*
* -- GETTER --
* Gets the value for {@link #disallowIntegratedGraphics}.

View file

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

View file

@ -15,7 +15,6 @@ module sosengine.graphics {
exports de.staropensource.sosengine.graphics;
exports de.staropensource.sosengine.graphics.classes;
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.window;
@ -23,7 +22,6 @@ module sosengine.graphics {
opens de.staropensource.sosengine.graphics;
opens de.staropensource.sosengine.graphics.classes;
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.window;
}