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 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
ConstructorsConstructorDescriptionInputManager(ViewPanel viewPanel) Creates an input manager attached to the given view panel. -
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) voidbooleanProcesses accumulated input events and updates camera based on mouse drag/wheel.
-
Constructor Details
-
InputManager
Creates an input manager attached to the given view panel.- Parameters:
viewPanel- the view panel to receive input from
-
-
Method Details
-
onFrame
Processes accumulated input events and updates camera based on mouse drag/wheel.- Specified by:
onFramein interfaceFrameListener- Parameters:
viewPanel- the view panelmillisecondsSinceLastFrame- time since last frame (unused)- Returns:
trueif a view repaint is needed
-
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
-