Ember
A C++ 20 'game engine' built with SDL3 with wide platform support.
|
#include <input_manager.h>
Public Member Functions | |
InputManager ()=default | |
InputManager (SDL_Window *window) | |
~InputManager () | |
void | process_event (const SDL_Event &event) |
void | update () |
void | late_update () |
bool | is_key_pressed (SDL_Scancode key) const |
bool | is_key_held (SDL_Scancode key) const |
bool | is_key_released (SDL_Scancode key) const |
InputState | get_key_state (SDL_Scancode key) const |
bool | are_keys_held (const std::vector< SDL_Scancode > &keys) const |
bool | any_key_pressed (const std::vector< SDL_Scancode > &keys) const |
glm::vec2 | get_mouse_position () const |
glm::vec2 | get_mouse_delta () const |
glm::vec2 | get_mouse_wheel () const |
bool | is_mouse_button_pressed (MouseButton button) const |
bool | is_mouse_button_held (MouseButton button) const |
bool | is_mouse_button_released (MouseButton button) const |
InputState | get_mouse_button_state (MouseButton button) const |
void | set_mouse_position (int x, int y) |
void | set_relative_mouse_mode (bool enabled) |
bool | is_relative_mouse_mode () const |
glm::vec2 | screen_to_world (const glm::vec2 &screen_pos) const |
glm::vec2 | world_to_screen (const glm::vec2 &world_pos) const |
size_t | get_gamepad_count () const |
const GamepadInfo * | get_gamepad (int index) const |
bool | is_gamepad_connected (int index) const |
bool | is_gamepad_button_pressed (int gamepad_index, int button) const |
bool | is_gamepad_button_held (int gamepad_index, int button) const |
bool | is_gamepad_button_released (int gamepad_index, int button) const |
float | get_gamepad_axis (int gamepad_index, int axis) const |
glm::vec2 | get_gamepad_stick (int gamepad_index, int stick_index) const |
void | set_gamepad_deadzone (int gamepad_index, float deadzone) |
const std::unordered_map< SDL_FingerID, TouchPoint > & | get_touch_points () const |
bool | is_touch_active (SDL_FingerID finger_id) const |
glm::vec2 | get_touch_position (SDL_FingerID finger_id) const |
size_t | get_active_touch_count () const |
TextInputManager & | get_text_input () |
void | start_text_input () |
void | stop_text_input () |
void | register_action (const InputAction &action) |
void | unregister_action (const std::string &action_name) |
bool | is_action_pressed (const std::string &action_name) const |
bool | is_action_held (const std::string &action_name) const |
bool | is_action_released (const std::string &action_name) const |
bool | position_in_rect (glm::vec2 position, const Rect2 &rect) const |
bool | mouse_in_rect (const Rect2 &rect) const |
void | set_input_blocked (bool blocked) |
bool | is_input_blocked () const |
void | print_debug_info () const |
std::vector< SDL_Scancode > | get_pressed_keys () const |
void | set_mouse_sensitivity (float sensitivity) |
float | get_mouse_sensitivity () const |
|
default |
|
explicit |
InputManager::~InputManager | ( | ) |
bool InputManager::any_key_pressed | ( | const std::vector< SDL_Scancode > & | keys | ) | const |
bool InputManager::are_keys_held | ( | const std::vector< SDL_Scancode > & | keys | ) | const |
size_t InputManager::get_active_touch_count | ( | ) | const |
const GamepadInfo * InputManager::get_gamepad | ( | int | index | ) | const |
float InputManager::get_gamepad_axis | ( | int | gamepad_index, |
int | axis | ||
) | const |
|
inline |
glm::vec2 InputManager::get_gamepad_stick | ( | int | gamepad_index, |
int | stick_index | ||
) | const |
InputState InputManager::get_key_state | ( | SDL_Scancode | key | ) | const |
InputState InputManager::get_mouse_button_state | ( | MouseButton | button | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
std::vector< SDL_Scancode > InputManager::get_pressed_keys | ( | ) | const |
|
inline |
|
inline |
glm::vec2 InputManager::get_touch_position | ( | SDL_FingerID | finger_id | ) | const |
bool InputManager::is_action_held | ( | const std::string & | action_name | ) | const |
bool InputManager::is_action_pressed | ( | const std::string & | action_name | ) | const |
bool InputManager::is_action_released | ( | const std::string & | action_name | ) | const |
bool InputManager::is_gamepad_button_held | ( | int | gamepad_index, |
int | button | ||
) | const |
bool InputManager::is_gamepad_button_pressed | ( | int | gamepad_index, |
int | button | ||
) | const |
bool InputManager::is_gamepad_button_released | ( | int | gamepad_index, |
int | button | ||
) | const |
bool InputManager::is_gamepad_connected | ( | int | index | ) | const |
|
inline |
bool InputManager::is_key_held | ( | SDL_Scancode | key | ) | const |
bool InputManager::is_key_pressed | ( | SDL_Scancode | key | ) | const |
bool InputManager::is_key_released | ( | SDL_Scancode | key | ) | const |
bool InputManager::is_mouse_button_held | ( | MouseButton | button | ) | const |
bool InputManager::is_mouse_button_pressed | ( | MouseButton | button | ) | const |
bool InputManager::is_mouse_button_released | ( | MouseButton | button | ) | const |
bool InputManager::is_relative_mouse_mode | ( | ) | const |
bool InputManager::is_touch_active | ( | SDL_FingerID | finger_id | ) | const |
void InputManager::late_update | ( | ) |
bool InputManager::mouse_in_rect | ( | const Rect2 & | rect | ) | const |
bool InputManager::position_in_rect | ( | glm::vec2 | position, |
const Rect2 & | rect | ||
) | const |
void InputManager::print_debug_info | ( | ) | const |
void InputManager::process_event | ( | const SDL_Event & | event | ) |
void InputManager::register_action | ( | const InputAction & | action | ) |
glm::vec2 InputManager::screen_to_world | ( | const glm::vec2 & | screen_pos | ) | const |
void InputManager::set_gamepad_deadzone | ( | int | gamepad_index, |
float | deadzone | ||
) |
|
inline |
void InputManager::set_mouse_position | ( | int | x, |
int | y | ||
) |
|
inline |
void InputManager::set_relative_mouse_mode | ( | bool | enabled | ) |
|
inline |
|
inline |
void InputManager::unregister_action | ( | const std::string & | action_name | ) |
void InputManager::update | ( | ) |
glm::vec2 InputManager::world_to_screen | ( | const glm::vec2 & | world_pos | ) | const |