Mercurial > repos > blastem
comparison nuklear_ui/blastem_nuklear.c @ 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 |
comparison
equal
deleted
inserted
replaced
1623:18a946ec74c8 | 1624:7bbe0bfedb58 |
---|---|
609 char *period = strchr(key, '.'); | 609 char *period = strchr(key, '.'); |
610 if (period) { | 610 if (period) { |
611 char *tmp = malloc(period-key + 1); | 611 char *tmp = malloc(period-key + 1); |
612 memcpy(tmp, key, period-key); | 612 memcpy(tmp, key, period-key); |
613 tmp[period-key] = 0; | 613 tmp[period-key] = 0; |
614 axis = render_lookup_axis(key); | 614 axis = render_lookup_axis(tmp); |
615 free(tmp); | 615 free(tmp); |
616 is_negative = strcmp(period+1, "negative") == 0; | 616 is_negative = strcmp(period+1, "negative") == 0; |
617 } else { | 617 } else { |
618 axis = render_lookup_axis(key); | 618 axis = render_lookup_axis(key); |
619 } | 619 } |
642 bindings = calloc(1, sizeof(*bindings)); | 642 bindings = calloc(1, sizeof(*bindings)); |
643 tern_node *pad = get_binding_node_for_pad(selected_controller); | 643 tern_node *pad = get_binding_node_for_pad(selected_controller); |
644 if (pad) { | 644 if (pad) { |
645 tern_foreach(tern_find_node(pad, "buttons"), button_iter, bindings); | 645 tern_foreach(tern_find_node(pad, "buttons"), button_iter, bindings); |
646 tern_foreach(tern_find_node(pad, "axes"), axis_iter, bindings); | 646 tern_foreach(tern_find_node(pad, "axes"), axis_iter, bindings); |
647 tern_node *dpad = tern_find_path(pad, "dpads\0" "0\0", TVAL_NODE).ptrval; | |
648 const char *dir_keys[] = {"up", "down", "right", "left"}; | |
649 const int button_idx[] = {SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_LEFT}; | |
650 for (int i = 0; i < NUM_AXIS_DIRS; i++) | |
651 { | |
652 bindings->button_binds[button_idx[i]] = tern_find_ptr(dpad, dir_keys[i]); | |
653 } | |
647 } | 654 } |
648 } | 655 } |
649 | 656 |
650 float orig_height = def_font->handle.height; | 657 float orig_height = def_font->handle.height; |
651 def_font->handle.height *= 0.5f; | 658 def_font->handle.height *= 0.5f; |