Class InputManager
java.lang.Object
eu.svjatoslav.sixth.e3d.gui.humaninput.InputManager
- All Implemented Interfaces:
FrameListener,KeyListener,MouseListener,MouseMotionListener,MouseWheelListener,EventListener
public class InputManager
extends Object
implements MouseMotionListener, KeyListener, MouseListener, MouseWheelListener, FrameListener
Manages mouse and keyboard input for the 3D view.
Handles Swing mouse/keyboard events, tracks pressed keys and mouse state, and forwards events to the appropriate handlers. Also provides default camera control via mouse dragging (look around) and mouse wheel (vertical movement).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisKeyPressed(int keyCode) Returns whether the specified key is currently pressed.voidkeyPressed(KeyEvent evt) voidkeyReleased(KeyEvent evt) voidvoidvoidmouseDragged(MouseEvent evt) voidvoidvoidvoidvoidmouseReleased(MouseEvent evt) voidbooleanCalled before each frame render, allowing the listener to update state and indicate whether a repaint is needed.
-
Constructor Details
-
InputManager
-
-
Method Details
-
onFrame
Description copied from interface:FrameListenerCalled before each frame render, allowing the listener to update state and indicate whether a repaint is needed.Each registered listener is called exactly once per frame tick. The frame is only rendered if at least one listener returns
true(or if the view was explicitly marked for repaint).- Specified by:
onFramein interfaceFrameListener- Parameters:
viewPanel- the view panel being renderedmillisecondsSinceLastFrame- time elapsed since the previous frame, for frame-rate-independent updates- Returns:
trueif the view should be re-rendered this frame,falseif this listener has no visual changes
-
isKeyPressed
public boolean isKeyPressed(int keyCode) Returns whether the specified key is currently pressed.- Parameters:
keyCode- the key code (fromKeyEvent)- Returns:
trueif the key is currently pressed
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-