1 modulepixelperfectengine.system.input.interfaces;
2 3 publicimportpixelperfectengine.system.input.types;
4 5 /**
6 * Listener for keyboard, joystick, etc. events.
7 */8 publicinterfaceInputListener {
9 /**
10 * Called when a keybinding event is generated.
11 * The `id` should be generated from a string, usually the name of the binding.
12 * `code` is a duplicate of the code used for fast lookup of the binding, which also contains other info (deviceID, etc).
13 * `timestamp` is the time lapsed since the start of the program, can be used to measure time between keypresses.
14 * NOTE: Hat events on joysticks don't generate keyReleased events, instead they generate keyPressed events on getting centered.
15 */16 publicvoidkeyEvent(uintid, BindingCodecode, uinttimestamp, boolisPressed);
17 /**
18 * Called when an axis is being operated.
19 * The `id` should be generated from a string, usually the name of the binding.
20 * `code` is a duplicate of the code used for fast lookup of the binding, which also contains other info (deviceID, etc).
21 * `timestamp` is the time lapsed since the start of the program, can be used to measure time between keypresses.
22 * `value` is the current position of the axis normalized between -1.0 and +1.0 for joysticks, and 0.0 and +1.0 for analog
23 * triggers.
24 */25 publicvoidaxisEvent(uintid, BindingCodecode, uinttimestamp, floatvalue);
26 }
27 /**
28 * Listener for system events. Controller adding and removal, quiting the application, etc.
29 */30 publicinterfaceSystemEventListener {
31 /**
32 * Called if the window is being closed.
33 */34 publicvoidonQuit();
35 /**
36 * Called if a controller was added.
37 * The `id` is the ID of the attached controller.
38 */39 publicvoidcontrollerAdded(uintid);
40 /**
41 * Called if a controller was removed.
42 * The `id` is the ID of the removed controller.
43 */44 publicvoidcontrollerRemoved(uintid);
45 }
46 /**
47 * Called on text input events.
48 */49 publicinterfaceTextInputListener {
50 /**
51 * Passes the inputted text to the target, alongside with a window ID and a timestamp.
52 */53 publicvoidtextInputEvent(uinttimestamp, uintwindowID, dstringtext);
54 /**
55 * Passes text editing events to the target, alongside with a window ID and a timestamp.
56 */57 publicvoidtextEditingEvent(uinttimestamp, uintwindowID, dstringtext, intstart, intlength);
58 /**
59 * Passes text input key events to the target, e.g. cursor keys.
60 */61 publicvoidtextInputKeyEvent(uinttimestamp, uintwindowID, TextInputKeykey, ushortmodifier);
62 /**
63 * When called, the listener should drop all text input.
64 */65 publicvoiddropTextInput();
66 /**
67 * Called if text input should be initialized.
68 */69 publicvoidinitTextInput();
70 }
71 /**
72 * Called on mouse events
73 */74 publicinterfaceMouseListener {
75 /**
76 * Called on mouse click events.
77 */78 publicvoidmouseClickEvent(MouseEventCommonsmec, MouseClickEventmce);
79 /**
80 * Called on mouse wheel events.
81 */82 publicvoidmouseWheelEvent(MouseEventCommonsmec, MouseWheelEventmwe);
83 /**
84 * Called on mouse motion events.
85 */86 publicvoidmouseMotionEvent(MouseEventCommonsmec, MouseMotionEventmme);
87 }