Package io.github.ocelot.window
Interface WindowEventListener
- All Known Implementing Classes:
KeyboardHandler,MouseHandler
public interface WindowEventListener
Listens to events on a
Window.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCalled when a character is typed.default voidcursorEntered(Window window, boolean entered) Called when the mouse enters or exists the window.default voidfilesDropped(Window window, Path... files) Called when files are dropped onto the window.default voidfocusChanged(Window window, boolean focused) Called when the window enters or exits focus.default voidframebufferResized(Window window, int width, int height) Called when the window framebuffer is resized.default voidkeyPressed(Window window, int key, int scanCode, KeyMods mods) Called when a key on the keyboard is pressed.default voidkeyReleased(Window window, int key, int scanCode, KeyMods mods) Called when a key on the keyboard is released.default voidkeyRepeated(Window window, int key, int scanCode, KeyMods mods) Called when a key on the keyboard is held util it repeats.default voidmouseMoved(Window window, double x, double y) Called when the mouse moves.default voidmousePressed(Window window, int button, KeyMods mods) Called when a mouse button is pressed.default voidmouseReleased(Window window, int button, KeyMods mods) Called when a mouse button is released.default voidmouseScrolled(Window window, double dx, double dy) Called when the mouse wheel is scrolled.default voidwindowClosed(Window window) Called when the window is closed.default voidwindowMoved(Window window, int x, int y) Called when the window is moved.default voidwindowResized(Window window, int width, int height) Called when the window is resized.
-
Method Details
-
windowClosed
Called when the window is closed.- Parameters:
window- The window that fired the event
-
windowMoved
Called when the window is moved.- Parameters:
window- The window that fired the eventx- The new x position of the windowy- The new y position of the window
-
windowResized
Called when the window is resized.
Note:framebufferResized(Window, int, int)should be used to resize rendering.- Parameters:
window- The window that fired the eventwidth- The new x size of the windowheight- The new y size of the window
-
framebufferResized
Called when the window framebuffer is resized.- Parameters:
window- The window that fired the eventwidth- The new x size of the framebufferheight- The new y size of the framebuffer
-
focusChanged
Called when the window enters or exits focus.- Parameters:
window- The window that fired the eventfocused- Whether the window is now focused
-
filesDropped
Called when files are dropped onto the window.- Parameters:
window- The window that fired the eventfiles- The paths to each file dropped
-
charTyped
Called when a character is typed.- Parameters:
window- The window that fired the eventcodePoint- The code point typed. To get actual chars useCharacter.toChars(int)mods- The keyboard modifier flags set when the key was typed
-
keyPressed
Called when a key on the keyboard is pressed.- Parameters:
window- The window that fired the eventkey- The universal key codescanCode- The machine-specific scan codemods- The keyboard modifier flags set when the key was pressed
-
keyReleased
Called when a key on the keyboard is released.- Parameters:
window- The window that fired the eventkey- The universal key codescanCode- The machine-specific scan codemods- The keyboard modifier flags set when the key was released
-
keyRepeated
Called when a key on the keyboard is held util it repeats.- Parameters:
window- The window that fired the eventkey- The universal key codescanCode- The machine-specific scan codemods- The keyboard modifier flags set when the key was repeated
-
mouseMoved
Called when the mouse moves.- Parameters:
window- The window that fired the eventx- The amount the mouse moved in the xy- The amount the mouse moved in the y
-
cursorEntered
Called when the mouse enters or exists the window.- Parameters:
window- The window that fired the evententered- Whether the cursor entered or left the window
-
mousePressed
Called when a mouse button is pressed.- Parameters:
window- The window that fired the eventbutton- The button that was pressed. Usually one of:
Standard Mouse Buttons MOUSE_BUTTON_LEFTMOUSE_BUTTON_RIGHTMOUSE_BUTTON_MIDDLEmods- The keyboard modifier flags set when the mouse button was pressed
-
mouseReleased
Called when a mouse button is released.- Parameters:
window- The window that fired the eventbutton- The button that was released. Usually one of:
Standard Mouse Buttons MOUSE_BUTTON_LEFTMOUSE_BUTTON_RIGHTMOUSE_BUTTON_MIDDLEmods- The keyboard modifier flags set when the mouse button was released
-
mouseScrolled
Called when the mouse wheel is scrolled.- Parameters:
window- The window that fired the eventdx- The motion in the x. This is for mice that can scroll horizontal as well as verticaldy- The motion in the y. This is the standard "mouse wheel" motion
-