Mercurial > repos > blastem
changeset 1624:7bbe0bfedb58
Handle looking up dpad config in binding UI. Fix left/right stick config display in binding UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 25 Oct 2018 19:12:40 -0700 |
parents | 18a946ec74c8 |
children | 6130e1e72151 |
files | nuklear_ui/blastem_nuklear.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/nuklear_ui/blastem_nuklear.c Wed Oct 24 21:10:12 2018 -0700 +++ b/nuklear_ui/blastem_nuklear.c Thu Oct 25 19:12:40 2018 -0700 @@ -611,7 +611,7 @@ char *tmp = malloc(period-key + 1); memcpy(tmp, key, period-key); tmp[period-key] = 0; - axis = render_lookup_axis(key); + axis = render_lookup_axis(tmp); free(tmp); is_negative = strcmp(period+1, "negative") == 0; } else { @@ -644,6 +644,13 @@ if (pad) { tern_foreach(tern_find_node(pad, "buttons"), button_iter, bindings); tern_foreach(tern_find_node(pad, "axes"), axis_iter, bindings); + tern_node *dpad = tern_find_path(pad, "dpads\0" "0\0", TVAL_NODE).ptrval; + const char *dir_keys[] = {"up", "down", "right", "left"}; + const int button_idx[] = {SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_LEFT}; + for (int i = 0; i < NUM_AXIS_DIRS; i++) + { + bindings->button_binds[button_idx[i]] = tern_find_ptr(dpad, dir_keys[i]); + } } }