Skip to content

Commit

Permalink
COMMS: Allow 'c' to trigger channel button
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen M. Cameron <[email protected]>
  • Loading branch information
smcameron committed Oct 21, 2023
1 parent 96ffd59 commit 37b9667
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions snis_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4674,6 +4674,7 @@ static void nav_lights_button_pressed(__attribute__((unused)) void *cookie);
static void standard_orbit_button_pressed(__attribute__((unused)) void *cookie);
static void nav_starmap_button_pressed(__attribute__((unused)) void *cookie);
static void comms_hail_button_pressed(__attribute__((unused)) void *x);
static void comms_channel_button_pressed(__attribute__((unused)) void *x);

static int key_press_cb(SDL_Window *window, SDL_Keysym *keysym, int key_repeat)
{
Expand Down Expand Up @@ -4773,6 +4774,12 @@ static int key_press_cb(SDL_Window *window, SDL_Keysym *keysym, int key_repeat)
snis_text_input_box_set_focus(comms_ui.comms_input, 1);
}
break;
case key_comms_channel:
if (!snis_text_input_box_has_focus(comms_ui.comms_input)) {
comms_channel_button_pressed(NULL);
snis_text_input_box_set_focus(comms_ui.comms_input, 1);
}
break;
case keytorpedo:
fire_torpedo_button_pressed(NULL);
break;
Expand Down
2 changes: 2 additions & 0 deletions snis_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ char *keyactionstring[] = {
"key_weap_wavlen_nudge_up",
"key_weap_wavlen_nudge_down",
"key_comms_hail",
"key_comms_channel",
};

#ifdef DEBUG_KEYMAP
Expand Down Expand Up @@ -419,6 +420,7 @@ void init_keymap(void)
mapkey(nav, SDLK_t, key_starmap);

mapkey(comms, SDLK_h, key_comms_hail);
mapkey(comms, SDLK_c, key_comms_channel);

#ifdef DEBUG_KEYMAP
print_keymap("keymap", keymap);
Expand Down
3 changes: 2 additions & 1 deletion snis_keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ enum keyaction {
key_weap_wavelen_nudge_up = 86,
key_weap_wavelen_nudge_down = 87,
key_comms_hail = 88,
#define NKEYSTATES 89
key_comms_channel = 89,
#define NKEYSTATES 90
};

struct keyboard_state {
Expand Down

0 comments on commit 37b9667

Please sign in to comment.