Input¶
-
namespace
tnt
-
namespace
input
¶ Functions
-
TNT_API bool keyDown (SDL_Scancode key) noexcept
Checks if a keyboard key is being held down.
- Return
true if
key
is held down.- Parameters
key
: The key to check.
-
TNT_API bool keyPressed (SDL_Scancode key) noexcept
Checks if a keyboard key is pressed.
- Return
true if
key
is pressed.- Parameters
key
: The key to check.
-
TNT_API bool keyReleased (SDL_Scancode key) noexcept
Checks if a keyboard key is released.
- Return
true if
key
is released.- Parameters
key
: The key to check.
-
TNT_API SDL_Scancode lastKeyPressed (SDL_Event const &e) noexcept
Get the last key pressed by checking the event handler.
- Return
SDL_Scancode
- Parameters
e
: The event handler to check.
-
TNT_API bool mouseButtonDown (Uint32 button) noexcept
Checks if a mouse button is being held down.
- Return
true if
button
is being held down.- Parameters
button
: The button to check.
-
TNT_API bool mouseButtonPressed (Uint32 button) noexcept
Checks if a mouse button is pressed.
- Return
true if
button
is pressed.- Parameters
button
: The button to check.
-
TNT_API bool mouseButtonReleased (Uint32 button) noexcept
Checks if a mouse button is released.
- Return
true if
button
is released.- Parameters
button
: The button to check.
-
TNT_API void updateCurrent ()
Updates the current input handles.
-
TNT_API void updatePrevious ()
Updates the last input handles.
-
TNT_API void updateJoystick ()
Updates joystick-related datas.
-
TNT_API void Update ()
Updates all the input handles.
-
TNT_API unsigned lastMouseButton () noexcept
- Return
The last mouse button pressed.
-
TNT_API std::pair< int, int > mousePosition () noexcept
- Return
The position of the mouse as a
std::pair<int, int>
.
-
TNT_API void setDefaultDeadZone (Sint16 sense) noexcept
Set the default sensitivity to all the connected joysticks.
- Note
The default sensitivity of the joystick when connected is 8000.
- Parameters
sense
: The desired sensitivity.
-
TNT_API void setDeadZone (SDL_JoystickID id, Sint16 sense) noexcept
Set the sensitivity of a joystick.
- Parameters
id
: The id of the joystick.sense
: The sensitivity of the joystick (from 0 to 32767).
-
TNT_API Sint16 getDeadZone (SDL_JoystickID id) noexcept
Get the sensitivity of the joystick.
- Return
Sint16
- Parameters
id
: The id of the joystick.
-
-
namespace