Brenta Engine 1.1
Loading...
Searching...
No Matches
brenta::input Class Reference

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.
 

Detailed Description

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.

Member Function Documentation

◆ add_keyboard_callback()

void input::add_keyboard_callback ( int key,
std::function< void()> callback )
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.

Parameters
keyThe key to add the callback to
callbackThe callback function

Definition at line 44 of file engine_input.cpp.

◆ add_mouse_pos_callback()

void input::add_mouse_pos_callback ( types::mouse_callback_name_t name,
std::function< void(double, double)> callback )
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.

Parameters
nameThe name of the callback
callbackThe callback function

Definition at line 75 of file engine_input.cpp.

◆ init()

void input::init ( )
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.

◆ key_callback()

void input::key_callback ( GLFWwindow * window,
int key,
int scancode,
int action,
int mods )
static

Keyboard callback.

This function is called when a key is pressed. It calls the callback function associated with the key.

Parameters
windowThe window that received the event
keyThe key that was pressed or released
scancodeThe system-specific scancode of the key
actionThe key action
modsBit field describing which modifier keys were held down

Definition at line 62 of file engine_input.cpp.

◆ mouse_pos_callback()

void input::mouse_pos_callback ( GLFWwindow * window,
double xpos,
double ypos )
static

Mouse position callback.

This function is called when the mouse is moved. It calls the callback function associated with the mouse position.

Parameters
windowThe window that received the event
xposThe new x-coordinate, in screen coordinates, of the cursor
yposThe new y-coordinate, in screen coordinates, of the cursor

Definition at line 95 of file engine_input.cpp.

◆ remove_keyboard_callback()

void input::remove_keyboard_callback ( int key)
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.

Parameters
keyThe key to remove the callback from

Definition at line 50 of file engine_input.cpp.

◆ remove_mouse_pos_callback()

void input::remove_mouse_pos_callback ( types::mouse_callback_name_t callback_name)
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.

Parameters
callback_nameThe name of the callback

Definition at line 82 of file engine_input.cpp.


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