Skip to content

Commit

Permalink
Add game controller bindings to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
fragglet committed Nov 28, 2024
1 parent 04f95fa commit 498b5c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/swconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ static const struct conf_option confoptions[] = {
{"key_home", CONF_KEY, {&keybindings[KEY_HOME]}},
{"key_missile", CONF_KEY, {&keybindings[KEY_MISSILE]}},
{"key_starburst", CONF_KEY, {&keybindings[KEY_STARBURST]}},

{"controller_accelerate", CONF_INT, {&controller_bindings[KEY_ACCEL]}},
{"controller_decelerate", CONF_INT, {&controller_bindings[KEY_DECEL]}},
{"controller_pullup", CONF_INT, {&controller_bindings[KEY_PULLUP]}},
{"controller_pulldown", CONF_INT, {&controller_bindings[KEY_PULLDOWN]}},
{"controller_flip", CONF_INT, {&controller_bindings[KEY_FLIP]}},
{"controller_fire", CONF_INT, {&controller_bindings[KEY_FIRE]}},
{"controller_dropbomb", CONF_INT, {&controller_bindings[KEY_BOMB]}},
{"controller_home", CONF_INT, {&controller_bindings[KEY_HOME]}},
};

static void Chomp(char *s)
Expand Down Expand Up @@ -236,7 +245,7 @@ void swsaveconf(void)
"# Created by " PACKAGE_STRING "\n\n");

for (i = 0; i < arrlen(confoptions); ++i) {
fprintf(fs, "%-20s", confoptions[i].name);
fprintf(fs, "%-25s ", confoptions[i].name);
switch (confoptions[i].type) {
case CONF_BOOL:
fprintf(fs, "%d", *confoptions[i].value.b);
Expand Down
1 change: 1 addition & 0 deletions src/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enum gamekey {

extern int keysdown[NUM_KEYS];
extern int keybindings[NUM_KEYS];
extern int controller_bindings[NUM_KEYS];

extern bool vid_fullscreen;
extern uint8_t *vid_vram;
Expand Down

0 comments on commit 498b5c9

Please sign in to comment.