X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fkeybindings.h;h=fc0faae354a7081d4da30aec60233b572ae1d333;hb=9ca325e8a2ad51fe53efae4130f5a9c40aa167c8;hp=ce15e6680197b19504145f800e2dd14d4d2b7368;hpb=550d22ec0c3f530f5d317746f3f7e75251a1de4b;p=plomrogue diff --git a/src/keybindings.h b/src/keybindings.h index ce15e66..fc0faae 100644 --- a/src/keybindings.h +++ b/src/keybindings.h @@ -6,10 +6,7 @@ #ifndef KEYBINDINGS_H #define KEYBINDINGS_H - - #include /* for uint16_t */ -struct World; @@ -21,8 +18,6 @@ struct KeyBinding char * name; /* name of functionality bound to keycode */ }; - - /* Wrapper to keybinding chain, contains some keybinding editing metadata. */ struct KeyBiData { @@ -33,6 +28,9 @@ struct KeyBiData +/* Return name of action / functionality coupled to keycode; NULL on failure. */ +extern char * get_func_to_keycode(struct KeyBinding * kb_p, uint16_t key); + /* Return keycode matched by keybinding to command of "name". */ extern uint16_t get_keycode_to_action(struct KeyBinding * keybindings, char * name); @@ -40,7 +38,7 @@ extern uint16_t get_keycode_to_action(struct KeyBinding * keybindings, /* Return human-readable name (of maximum 9 chars) for "keycode" as matched by * ncurses.h; if none is found, return "UNKNOWN". */ -extern char * get_name_to_keycode(struct World * world, uint16_t keycode); +extern char * get_name_to_keycode(uint16_t keycode); /* Return number of keybindings in keybindings chain from "kb_p" on. */ extern uint16_t get_n_of_keybs(struct KeyBinding * kb_p); @@ -48,26 +46,20 @@ extern uint16_t get_n_of_keybs(struct KeyBinding * kb_p); /* Return "n"-th keybinding in keybindings chain from "kb_p" on. */ extern struct KeyBinding * get_keyb_of_n(struct KeyBinding * kb_p, uint16_t n); - - /* Initialize/save keybindings data from/to file at "path" to/from keybindings * data pointer "kbd". */ -extern void init_keybindings(struct World * world, char * path, - struct KeyBiData * kbd); -extern void save_keybindings(struct World * world, char * path, - struct KeyBiData * kbd); +extern void init_keybindings(char * path, struct KeyBiData * kbd); +extern void save_keybindings(char * path, struct KeyBiData * kbd); /* Free keybinding chain starting at "kb_start". */ extern void free_keybindings(struct KeyBinding * kb_start); - - /* Mark keybinding selected for modification as being edited, get user input to * modify it, then unmark it again. Ensure there are max. three digits in the * keycode ASCII representation. */ -extern void mod_selected_keyb(struct World * world, struct KeyBiData * kbd); +extern void mod_selected_keyb(struct KeyBiData * kbd); /* Move keybinding modification selection upwards ("dir"=="u") or downwards * ("dir"=="d") within the limits of the keybindings chain length.