My Project
Loading...
Searching...
No Matches
Engine::InputManager Class Reference

Handles keyboard and mouse input. Tracks key states, mouse buttons, and mouse movement. More...

#include <InputManager.hpp>

Public Member Functions

 InputManager ()
 ~InputManager ()
void init ()
 Initializes the input system. Must be called before using input functions.
void update ()
 Updates the internal input state. Should be called once per frame.
void updateKey (Scancode scancode, bool isDown)
 Updates the state of a keyboard key.
bool isKeyPressed (Scancode scancode) const
 Checks if the key was pressed this frame.
bool isKeyHeld (Scancode scancode) const
 Checks if the key is being held down.
bool isKeyReleased (Scancode scancode) const
 Checks if the key was released this frame.
void updateMouseButton (MouseButton button, bool isDown)
 Updates the state of a mouse button.
bool isMousePressed (MouseButton button) const
 Checks if the mouse button was pressed this frame.
bool isMouseHeld (MouseButton button) const
 Checks if the mouse button is being held down.
bool isMouseReleased (MouseButton button) const
 Checks if the mouse button was released this frame.
void setMousePosition (Maths::Vec2f pos)
 Sets the current mouse position.
Maths::Vec2f getMousePosition () const
 Returns the current mouse position.
Maths::Vec2f getMouseDelta () const
 Returns the delta movement of the mouse since last frame.
Maths::Vec2f getPreviousMousePosition () const
 Returns the previous mouse position.

Detailed Description

Handles keyboard and mouse input. Tracks key states, mouse buttons, and mouse movement.

Constructor & Destructor Documentation

◆ InputManager()

Engine::InputManager::InputManager ( )

◆ ~InputManager()

Engine::InputManager::~InputManager ( )

Member Function Documentation

◆ getMouseDelta()

Maths::Vec2f Engine::InputManager::getMouseDelta ( ) const

Returns the delta movement of the mouse since last frame.

◆ getMousePosition()

Maths::Vec2f Engine::InputManager::getMousePosition ( ) const

Returns the current mouse position.

◆ getPreviousMousePosition()

Maths::Vec2f Engine::InputManager::getPreviousMousePosition ( ) const

Returns the previous mouse position.

◆ init()

void Engine::InputManager::init ( )

Initializes the input system. Must be called before using input functions.

◆ isKeyHeld()

bool Engine::InputManager::isKeyHeld ( Scancode scancode) const

Checks if the key is being held down.

◆ isKeyPressed()

bool Engine::InputManager::isKeyPressed ( Scancode scancode) const

Checks if the key was pressed this frame.

◆ isKeyReleased()

bool Engine::InputManager::isKeyReleased ( Scancode scancode) const

Checks if the key was released this frame.

◆ isMouseHeld()

bool Engine::InputManager::isMouseHeld ( MouseButton button) const

Checks if the mouse button is being held down.

◆ isMousePressed()

bool Engine::InputManager::isMousePressed ( MouseButton button) const

Checks if the mouse button was pressed this frame.

◆ isMouseReleased()

bool Engine::InputManager::isMouseReleased ( MouseButton button) const

Checks if the mouse button was released this frame.

◆ setMousePosition()

void Engine::InputManager::setMousePosition ( Maths::Vec2f pos)

Sets the current mouse position.

◆ update()

void Engine::InputManager::update ( )

Updates the internal input state. Should be called once per frame.

◆ updateKey()

void Engine::InputManager::updateKey ( Scancode scancode,
bool isDown )

Updates the state of a keyboard key.

Parameters
scancodeKey scancode
isDownWhether the key is pressed

◆ updateMouseButton()

void Engine::InputManager::updateMouseButton ( MouseButton button,
bool isDown )

Updates the state of a mouse button.

Parameters
buttonMouse button
isDownWhether the button is pressed

The documentation for this class was generated from the following file: