Brenta Engine 1.1
|
Input subsystem. More...
#include <engine_input.hpp>
Static Public Member Functions | |
static void | init () |
Initialize the input system. | |
static void | add_keyboard_callback (int key, std::function< void()> callback) |
Add a keyboard callback. | |
static void | remove_keyboard_callback (int key) |
Remove a keyboard callback. | |
static void | key_callback (GLFWwindow *window, int key, int scancode, int action, int mods) |
Keyboard callback. | |
static void | add_mouse_pos_callback (types::mouse_callback_name_t name, std::function< void(double, double)> callback) |
Add a mouse position callback. | |
static void | remove_mouse_pos_callback (types::mouse_callback_name_t callback_name) |
Remove a mouse position callback. | |
static void | mouse_pos_callback (GLFWwindow *window, double xpos, double ypos) |
Mouse position callback. | |
Input subsystem.
This subsystem is used to manage the input system of the engine. It is used to add and remove callbacks for keyboard and mouse events. You can define your own callbacks and register them with the input subsystem.
Definition at line 52 of file engine_input.hpp.
|
static |
Add a keyboard callback.
This function adds a callback to a key press event. The callback is a function that takes no arguments and returns void. The key enum is defined in GLFW. When the key is pressed, the callback is called.
key | The key to add the callback to |
callback | The callback function |
Definition at line 44 of file engine_input.cpp.
|
static |
Add a mouse position callback.
This function adds a callback to a mouse position event. The callback is a function that takes two doubles and returns void. The two doubles are the x and y position of the mouse. When the mouse is moved, the callback is called.
name | The name of the callback |
callback | The callback function |
Definition at line 75 of file engine_input.cpp.
|
static |
Initialize the input system.
This function initializes the input system. It should be called before any other input function is called.
Definition at line 36 of file engine_input.cpp.
|
static |
Keyboard callback.
This function is called when a key is pressed. It calls the callback function associated with the key.
window | The window that received the event |
key | The key that was pressed or released |
scancode | The system-specific scancode of the key |
action | The key action |
mods | Bit field describing which modifier keys were held down |
Definition at line 62 of file engine_input.cpp.
|
static |
Mouse position callback.
This function is called when the mouse is moved. It calls the callback function associated with the mouse position.
window | The window that received the event |
xpos | The new x-coordinate, in screen coordinates, of the cursor |
ypos | The new y-coordinate, in screen coordinates, of the cursor |
Definition at line 95 of file engine_input.cpp.
|
static |
Remove a keyboard callback.
This function removes a callback from a key press event. The key enum is defined in GLFW. When the key is pressed, the callback is removed.
key | The key to remove the callback from |
Definition at line 50 of file engine_input.cpp.
|
static |
Remove a mouse position callback.
This function removes a callback from a mouse position event. When the mouse is moved, the callback is removed.
callback_name | The name of the callback |
Definition at line 82 of file engine_input.cpp.