twn_input.h: remove unbinding

This commit is contained in:
veclavtalica 2024-10-28 13:04:07 +03:00
parent eff9fe6918
commit 6464d14b3e
3 changed files with 19 additions and 23 deletions

View File

@ -85,7 +85,7 @@ typedef struct DrawCameraFromPrincipalAxesResult {
Vec3 direction; Vec3 direction;
Vec3 up; Vec3 up;
} DrawCameraFromPrincipalAxesResult; } DrawCameraFromPrincipalAxesResult;
DrawCameraFromPrincipalAxesResult TWN_API draw_camera_from_principal_axes(Vec3 position, TWN_API DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position,
float fov, float fov,
float roll, float roll,
float pitch, float pitch,

View File

@ -11,14 +11,10 @@
TWN_API void input_bind_action_control(const char *action_name, Control control); TWN_API void input_bind_action_control(const char *action_name, Control control);
TWN_API void input_unbind_action_control(const char *action_name, Control control);
TWN_API bool input_is_action_pressed(const char *action_name); TWN_API bool input_is_action_pressed(const char *action_name);
TWN_API bool input_is_action_just_pressed(const char *action_name); TWN_API bool input_is_action_just_pressed(const char *action_name);
TWN_API bool input_is_action_just_released(const char *action_name); TWN_API bool input_is_action_just_released(const char *action_name);
TWN_API Vec2 input_get_action_position(const char *action_name); TWN_API Vec2 input_get_action_position(const char *action_name);
TWN_API void input_set_mouse_captured(bool enabled); TWN_API void input_set_mouse_captured(bool enabled);
#endif #endif

View File

@ -275,26 +275,26 @@ void input_bind_action_control(char const *action_name,
} }
void input_unbind_action_control(char const *action_name, // static void input_unbind_action_control(char const *action_name,
Control control) // Control control)
{ // {
SDL_assert_always(action_name); // SDL_assert_always(action_name);
if (CONTROL_SCANCODE_START <= control && control < CONTROL_SCANCODE_LIMIT) // if (CONTROL_SCANCODE_START <= control && control < CONTROL_SCANCODE_LIMIT)
input_unbind_code_from_action(&ctx.input, // input_unbind_code_from_action(&ctx.input,
action_name, // action_name,
BUTTON_SOURCE_KEYBOARD_PHYSICAL, // BUTTON_SOURCE_KEYBOARD_PHYSICAL,
(union ButtonCode) { .scancode = (SDL_Scancode)control }); // (union ButtonCode) { .scancode = (SDL_Scancode)control });
else if (CONTROL_MOUSECODE_START <= control && control < CONTROL_MOUSECODE_LIMIT) { // else if (CONTROL_MOUSECODE_START <= control && control < CONTROL_MOUSECODE_LIMIT) {
uint8_t const mouse_button = (uint8_t)(control - CONTROL_MOUSECODE_START); // uint8_t const mouse_button = (uint8_t)(control - CONTROL_MOUSECODE_START);
input_unbind_code_from_action(&ctx.input, // input_unbind_code_from_action(&ctx.input,
action_name, // action_name,
BUTTON_SOURCE_MOUSE, // BUTTON_SOURCE_MOUSE,
(union ButtonCode) { .mouse_button = (uint8_t)SDL_BUTTON(mouse_button)}); // (union ButtonCode) { .mouse_button = (uint8_t)SDL_BUTTON(mouse_button)});
} else // } else
log_warn("(%s) Invalid control value given: %i.", __func__, control); // log_warn("(%s) Invalid control value given: %i.", __func__, control);
} // }
bool input_is_action_pressed(char const *action_name) { bool input_is_action_pressed(char const *action_name) {