mirror of
https://github.com/phoboslab/wipeout-rewrite
synced 2024-12-26 09:59:04 +01:00
Fix input problems when rebinding input
This commit is contained in:
parent
0e3422d345
commit
24b6efd3ea
2 changed files with 10 additions and 9 deletions
18
src/input.c
18
src/input.c
|
@ -200,15 +200,14 @@ void input_set_layer_button_state(input_layer_t layer, button_t button, float st
|
||||||
void input_set_button_state(button_t button, float state) {
|
void input_set_button_state(button_t button, float state) {
|
||||||
error_if(button < 0 || button >= INPUT_BUTTON_MAX, "Invalid input button %d", button);
|
error_if(button < 0 || button >= INPUT_BUTTON_MAX, "Invalid input button %d", button);
|
||||||
|
|
||||||
if (capture_callback) {
|
|
||||||
if (state) {
|
|
||||||
capture_callback(capture_user, button, 0);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_set_layer_button_state(INPUT_LAYER_SYSTEM, button, state);
|
input_set_layer_button_state(INPUT_LAYER_SYSTEM, button, state);
|
||||||
input_set_layer_button_state(INPUT_LAYER_USER, button, state);
|
input_set_layer_button_state(INPUT_LAYER_USER, button, state);
|
||||||
|
|
||||||
|
if (capture_callback) {
|
||||||
|
if (state > INPUT_DEADZONE_CAPTURE) {
|
||||||
|
capture_callback(capture_user, button, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_set_mouse_pos(int32_t x, int32_t y) {
|
void input_set_mouse_pos(int32_t x, int32_t y) {
|
||||||
|
@ -219,12 +218,12 @@ void input_set_mouse_pos(int32_t x, int32_t y) {
|
||||||
void input_capture(input_capture_callback_t cb, void *user) {
|
void input_capture(input_capture_callback_t cb, void *user) {
|
||||||
capture_callback = cb;
|
capture_callback = cb;
|
||||||
capture_user = user;
|
capture_user = user;
|
||||||
clear(actions_state);
|
input_clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void input_textinput(int32_t ascii_char) {
|
void input_textinput(int32_t ascii_char) {
|
||||||
if (capture_callback) {
|
if (capture_callback) {
|
||||||
capture_callback(capture_user, 0, ascii_char);
|
capture_callback(capture_user, INPUT_INVALID, ascii_char);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,6 +232,7 @@ void input_bind(input_layer_t layer, button_t button, uint8_t action) {
|
||||||
error_if(action < 0 || action >= INPUT_ACTION_MAX, "Invalid input action %d", action);
|
error_if(action < 0 || action >= INPUT_ACTION_MAX, "Invalid input action %d", action);
|
||||||
error_if(layer < 0 || layer >= INPUT_LAYER_MAX, "Invalid input layer %d", layer);
|
error_if(layer < 0 || layer >= INPUT_LAYER_MAX, "Invalid input layer %d", layer);
|
||||||
|
|
||||||
|
actions_state[action] = 0;
|
||||||
bindings[layer][button] = action;
|
bindings[layer][button] = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ const char *input_button_to_name(button_t button);
|
||||||
#define INPUT_ACTION_COMMAND 31
|
#define INPUT_ACTION_COMMAND 31
|
||||||
#define INPUT_ACTION_MAX 32
|
#define INPUT_ACTION_MAX 32
|
||||||
#define INPUT_DEADZONE 0.1
|
#define INPUT_DEADZONE 0.1
|
||||||
|
#define INPUT_DEADZONE_CAPTURE 0.5
|
||||||
#define INPUT_ACTION_NONE 255
|
#define INPUT_ACTION_NONE 255
|
||||||
#define INPUT_BUTTON_NONE 0
|
#define INPUT_BUTTON_NONE 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue