4 "Disables this gamepad axis mapping.",
5 "Left stick horizontal axis.",
6 "Left stick vertical axis.",
7 "Right stick horizontal axis.",
8 "Right stick vertical axis.",
10 "Right trigger axis.",
16 "movement uses the left stick; camera RZ "
17 "uses the right stick X axis.";
21 "Bind waits for a button; Clear leaves the "
27 "trigger to remap this SDL source row.";
53 const int *saved_values,
54 const int *default_values,
58 state->config.gamepad_axes[axis_index] != saved_values[axis_index],
59 state->config.gamepad_axes[axis_index] != default_values[axis_index]
65 const int *saved_values,
66 const int *default_values,
70 state->config.gamepad_axis_deadzone[axis_index] != saved_values[axis_index],
71 state->config.gamepad_axis_deadzone[axis_index] != default_values[axis_index]
86 &
state->config.gamepad_axes[axis_index],
92 state->saved_config.gamepad_axes,
93 state->defaults.gamepad_axes,
110 &
state->config.gamepad_axis_deadzone[axis_index],
116 state->saved_config.gamepad_axis_deadzone,
117 state->defaults.gamepad_axis_deadzone,
128 return "left_trigger";
130 return "right_trigger";
139 const char *label = SDL_GetGamepadStringForButton((SDL_GamepadButton)
source);
146 return "No controller input is bound to this game action.";
147 case SDL_GAMEPAD_BUTTON_SOUTH:
149 case SDL_GAMEPAD_BUTTON_EAST:
151 case SDL_GAMEPAD_BUTTON_START:
159 switch (
event->type) {
160 case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
161 return event->gbutton.button;
162 case SDL_EVENT_GAMEPAD_AXIS_MOTION:
167 switch (
event->gaxis.axis) {
168 case SDL_GAMEPAD_AXIS_LEFT_TRIGGER:
170 case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER:
184 "##gamepad_axes_table",
195 &
state->config.gamepad_enabled,
203 &
state->config.gamepad_index,
240 const int action =
state->button_actions[row];
245 igAlignTextToFramePadding();
253 igAlignTextToFramePadding();
260 state->binding_row = row;
261 set_status(
state,
"Press a gamepad button or trigger. Press Esc to cancel.");
290 igSeparatorText(
"Button Mappings");
293 if (
state->binding_row >= 0) {
295 "Waiting for input for %s...",
312 if (!igBeginChild_Str(
314 (ImVec2_c){0.0f, 0.0f},
315 ImGuiChildFlags_None,
316 ImGuiWindowFlags_None
const DTTR_BackendState * state
void void DWORD HANDLE event
#define DTTR_GAMEPAD_SOURCE_TRIGGER_RIGHT
#define DTTR_GAMEPAD_AXIS_IDX_STICK_Y
#define DTTR_GAMEPAD_AXIS_IDX_CAMERA_RZ
#define DTTR_GAMEPAD_TRIGGER_THRESHOLD
#define DTTR_GAMEPAD_MAPPING_NONE
#define DTTR_GAMEPAD_SOURCE_TRIGGER_LEFT
@ DTTR_CONFIG_CHOICES_GAMEPAD_AXIS
#define DTTR_GAMEPAD_AXIS_IDX_STICK_X
union SDL_Event SDL_Event
static game_data_source source
int gamepad_default_source_for_action(const config_ui_state *state, int action)
bool themed_row_button(const DTTR_ImGuiDialogContext *ctx, const char *id, const char *label, float width)
config_label_state make_config_label_state(bool unsaved_changed, bool default_changed)
bool begin_gamepad_button_table(const DTTR_ImGuiDialogContext *ctx)
const char * gamepad_button_row_label(int row)
bool labeled_input_int(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, int *value, int step, int step_fast, const char *tooltip, config_label_state label_state)
bool labeled_checkbox(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, bool *value, const char *tooltip, config_label_state label_state)
bool begin_settings_table(const DTTR_ImGuiDialogContext *ctx, const char *id, float label_width, float input_width)
void draw_config_label(const char *label, const char *tooltip, config_label_state label_state)
void show_tooltip(const char *text)
void add_scaled_vertical_spacing(const DTTR_ImGuiDialogContext *ctx, float height)
#define DTTR_CONFIG_UI_SECTION_SPACING
void begin_config_table_row()
void end_settings_table()
#define DTTR_CONFIG_UI_LABEL_W
#define DTTR_CONFIG_UI_GAMEPAD_BUTTON_W
#define FIELD_LABEL_STATE(state, field)
#define DTTR_CONFIG_UI_INPUT_W
int gamepad_button_row_count()
config_label_state gamepad_button_label_state(const config_ui_state *state, int source, int action)
bool labeled_choice_combo(const DTTR_ImGuiDialogContext *ctx, const char *label, const char *id, int *value, DTTR_ConfigChoiceList choices, const char *const *tooltips, const char *tooltip, config_label_state label_state)
void set_status(config_ui_state *state, const char *status)
const char * game_action_tooltip(int action)
const char * source_tooltip(int source)
static const char * TOOLTIP_GAMEPAD_SOUTH
static const char * TOOLTIP_GAMEPAD_INDEX
static const gamepad_axis_field GAMEPAD_DEADZONE_FIELDS[]
static const char * TOOLTIP_RESET_BUTTON
static config_label_state gamepad_axis_label_state(const config_ui_state *state, const int *saved_values, const int *default_values, int axis_index)
static const char *const GAMEPAD_SOURCE_UNKNOWN
const char * source_label(int source)
static const char * TOOLTIP_GAMEPAD_AXIS
static void draw_gamepad_deadzone_input(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state, const char *label, const char *id, int axis_index)
static const gamepad_axis_field GAMEPAD_AXIS_FIELDS[]
static void draw_gamepad_button_row(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state, int row)
static const char * TOOLTIP_CLEAR_BUTTON
static const char * TOOLTIP_BIND_BUTTON
static void draw_gamepad_axis_choice(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state, const char *label, const char *id, int axis_index)
static const char * TOOLTIP_GAMEPAD_ENABLED
static const char * TOOLTIP_GAMEPAD_EAST
static const char * TOOLTIP_GAMEPAD_DEADZONE
static const char * TOOLTIP_GAMEPAD_BUTTONS
static void draw_gamepad_axes(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
int source_from_event(const SDL_Event *event)
void draw_gamepad_tab(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
static config_label_state gamepad_deadzone_label_state(const config_ui_state *state, const int *saved_values, const int *default_values, int axis_index)
static const char *const GAMEPAD_AXIS_TOOLTIPS[]
static void draw_gamepad_buttons(const DTTR_ImGuiDialogContext *ctx, config_ui_state *state)
static const char * TOOLTIP_GAMEPAD_START