diff --git a/Makefile b/Makefile index 6613457..6b1dbf4 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ INSTALL=/usr/bin/install -c cabrio: main.o ogl.o sdl.o config.o bg.o menu.o game_sel.o \ game.o font.o hint.o genre.o platform.o submenu.o \ - sound.o event.o + sound.o event.o key.o $(CC) -o $@ $(LDFLAGS) $^ .c.o: %.c diff --git a/config.c b/config.c index 6d2a28f..3183bb9 100644 --- a/config.c +++ b/config.c @@ -9,6 +9,7 @@ #include #include #include "config.h" +#include "key.h" #include "sdl.h" #include @@ -55,242 +56,6 @@ static const char *config_false = "false"; static const char *warn_alloc = "Warning: Couldn't allocate memory for '%s' object\n"; static const char *warn_skip = "Warning: Skipping unrecognised XML element in '%s': '%s'\n"; -/* Defined at the end of this file... */ -int config_key( char *name ); -const char *config_key_name( int key ); -/* Big list o' key names. These are just the SDLK_* macros with their prefix chopped off. */ -static const char *config_key_backspace = "backspace"; -static const char *config_key_tab = "tab"; -static const char *config_key_clear = "clear"; -static const char *config_key_return = "return"; -static const char *config_key_pause = "pause"; -static const char *config_key_escape = "escape"; -static const char *config_key_space = "space"; -static const char *config_key_exclaim = "exclaim"; -static const char *config_key_quotedbl = "quotedbl"; -static const char *config_key_hash = "hash"; -static const char *config_key_dollar = "dollar"; -static const char *config_key_ampersand = "ampersand"; -static const char *config_key_quote = "quote"; -static const char *config_key_leftparen = "leftparen"; -static const char *config_key_rightparen = "rightparen"; -static const char *config_key_asterisk = "asterisk"; -static const char *config_key_plus = "plus"; -static const char *config_key_comma = "comma"; -static const char *config_key_minus = "minus"; -static const char *config_key_period = "period"; -static const char *config_key_slash = "slash"; -static const char *config_key_0 = "0"; -static const char *config_key_1 = "1"; -static const char *config_key_2 = "2"; -static const char *config_key_3 = "3"; -static const char *config_key_4 = "4"; -static const char *config_key_5 = "5"; -static const char *config_key_6 = "6"; -static const char *config_key_7 = "7"; -static const char *config_key_8 = "8"; -static const char *config_key_9 = "9"; -static const char *config_key_colon = "colon"; -static const char *config_key_semicolon = "semicolon"; -static const char *config_key_less = "less"; -static const char *config_key_equals = "equals"; -static const char *config_key_greater = "greater"; -static const char *config_key_question = "question"; -static const char *config_key_at = "at"; -static const char *config_key_leftbracket = "leftbracket"; -static const char *config_key_backslash = "backslash"; -static const char *config_key_rightbracket = "rightbracket"; -static const char *config_key_caret = "caret"; -static const char *config_key_underscore = "underscore"; -static const char *config_key_backquote = "backquote"; -static const char *config_key_a = "a"; -static const char *config_key_b = "b"; -static const char *config_key_c = "c"; -static const char *config_key_d = "d"; -static const char *config_key_e = "e"; -static const char *config_key_f = "f"; -static const char *config_key_g = "g"; -static const char *config_key_h = "h"; -static const char *config_key_i = "i"; -static const char *config_key_j = "j"; -static const char *config_key_k = "k"; -static const char *config_key_l = "l"; -static const char *config_key_m = "m"; -static const char *config_key_n = "n"; -static const char *config_key_o = "o"; -static const char *config_key_p = "p"; -static const char *config_key_q = "q"; -static const char *config_key_r = "r"; -static const char *config_key_s = "s"; -static const char *config_key_t = "t"; -static const char *config_key_u = "u"; -static const char *config_key_v = "v"; -static const char *config_key_w = "w"; -static const char *config_key_x = "x"; -static const char *config_key_y = "y"; -static const char *config_key_z = "z"; -static const char *config_key_delete = "delete"; -static const char *config_key_world_0 = "world_0"; -static const char *config_key_world_1 = "world_1"; -static const char *config_key_world_2 = "world_2"; -static const char *config_key_world_3 = "world_3"; -static const char *config_key_world_4 = "world_4"; -static const char *config_key_world_5 = "world_5"; -static const char *config_key_world_6 = "world_6"; -static const char *config_key_world_7 = "world_7"; -static const char *config_key_world_8 = "world_8"; -static const char *config_key_world_9 = "world_9"; -static const char *config_key_world_10 = "world_10"; -static const char *config_key_world_11 = "world_11"; -static const char *config_key_world_12 = "world_12"; -static const char *config_key_world_13 = "world_13"; -static const char *config_key_world_14 = "world_14"; -static const char *config_key_world_15 = "world_15"; -static const char *config_key_world_16 = "world_16"; -static const char *config_key_world_17 = "world_17"; -static const char *config_key_world_18 = "world_18"; -static const char *config_key_world_19 = "world_19"; -static const char *config_key_world_20 = "world_20"; -static const char *config_key_world_21 = "world_21"; -static const char *config_key_world_22 = "world_22"; -static const char *config_key_world_23 = "world_23"; -static const char *config_key_world_24 = "world_24"; -static const char *config_key_world_25 = "world_25"; -static const char *config_key_world_26 = "world_26"; -static const char *config_key_world_27 = "world_27"; -static const char *config_key_world_28 = "world_28"; -static const char *config_key_world_29 = "world_29"; -static const char *config_key_world_30 = "world_30"; -static const char *config_key_world_31 = "world_31"; -static const char *config_key_world_32 = "world_32"; -static const char *config_key_world_33 = "world_33"; -static const char *config_key_world_34 = "world_34"; -static const char *config_key_world_35 = "world_35"; -static const char *config_key_world_36 = "world_36"; -static const char *config_key_world_37 = "world_37"; -static const char *config_key_world_38 = "world_38"; -static const char *config_key_world_39 = "world_39"; -static const char *config_key_world_40 = "world_40"; -static const char *config_key_world_41 = "world_41"; -static const char *config_key_world_42 = "world_42"; -static const char *config_key_world_43 = "world_43"; -static const char *config_key_world_44 = "world_44"; -static const char *config_key_world_45 = "world_45"; -static const char *config_key_world_46 = "world_46"; -static const char *config_key_world_47 = "world_47"; -static const char *config_key_world_48 = "world_48"; -static const char *config_key_world_49 = "world_49"; -static const char *config_key_world_50 = "world_50"; -static const char *config_key_world_51 = "world_51"; -static const char *config_key_world_52 = "world_52"; -static const char *config_key_world_53 = "world_53"; -static const char *config_key_world_54 = "world_54"; -static const char *config_key_world_55 = "world_55"; -static const char *config_key_world_56 = "world_56"; -static const char *config_key_world_57 = "world_57"; -static const char *config_key_world_58 = "world_58"; -static const char *config_key_world_59 = "world_59"; -static const char *config_key_world_60 = "world_60"; -static const char *config_key_world_61 = "world_61"; -static const char *config_key_world_62 = "world_62"; -static const char *config_key_world_63 = "world_63"; -static const char *config_key_world_64 = "world_64"; -static const char *config_key_world_65 = "world_65"; -static const char *config_key_world_66 = "world_66"; -static const char *config_key_world_67 = "world_67"; -static const char *config_key_world_68 = "world_68"; -static const char *config_key_world_69 = "world_69"; -static const char *config_key_world_70 = "world_70"; -static const char *config_key_world_71 = "world_71"; -static const char *config_key_world_72 = "world_72"; -static const char *config_key_world_73 = "world_73"; -static const char *config_key_world_74 = "world_74"; -static const char *config_key_world_75 = "world_75"; -static const char *config_key_world_76 = "world_76"; -static const char *config_key_world_77 = "world_77"; -static const char *config_key_world_78 = "world_78"; -static const char *config_key_world_79 = "world_79"; -static const char *config_key_world_80 = "world_80"; -static const char *config_key_world_81 = "world_81"; -static const char *config_key_world_82 = "world_82"; -static const char *config_key_world_83 = "world_83"; -static const char *config_key_world_84 = "world_84"; -static const char *config_key_world_85 = "world_85"; -static const char *config_key_world_86 = "world_86"; -static const char *config_key_world_87 = "world_87"; -static const char *config_key_world_88 = "world_88"; -static const char *config_key_world_89 = "world_89"; -static const char *config_key_world_90 = "world_90"; -static const char *config_key_world_91 = "world_91"; -static const char *config_key_world_92 = "world_92"; -static const char *config_key_world_93 = "world_93"; -static const char *config_key_world_94 = "world_94"; -static const char *config_key_world_95 = "world_95"; -static const char *config_key_kp0 = "kp0"; -static const char *config_key_kp1 = "kp1"; -static const char *config_key_kp2 = "kp2"; -static const char *config_key_kp3 = "kp3"; -static const char *config_key_kp4 = "kp4"; -static const char *config_key_kp5 = "kp5"; -static const char *config_key_kp6 = "kp6"; -static const char *config_key_kp7 = "kp7"; -static const char *config_key_kp8 = "kp8"; -static const char *config_key_kp9 = "kp9"; -static const char *config_key_kp_period = "kp_period"; -static const char *config_key_kp_divide = "kp_divide"; -static const char *config_key_kp_multiply = "kp_multiply"; -static const char *config_key_kp_minus = "kp_minus"; -static const char *config_key_kp_plus = "kp_plus"; -static const char *config_key_kp_enter = "kp_enter"; -static const char *config_key_kp_equals = "kp_equals"; -static const char *config_key_up = "up"; -static const char *config_key_down = "down"; -static const char *config_key_right = "right"; -static const char *config_key_left = "left"; -static const char *config_key_insert = "insert"; -static const char *config_key_home = "home"; -static const char *config_key_end = "end"; -static const char *config_key_pageup = "pageup"; -static const char *config_key_pagedown = "pagedown"; -static const char *config_key_f1 = "f1"; -static const char *config_key_f2 = "f2"; -static const char *config_key_f3 = "f3"; -static const char *config_key_f4 = "f4"; -static const char *config_key_f5 = "f5"; -static const char *config_key_f6 = "f6"; -static const char *config_key_f7 = "f7"; -static const char *config_key_f8 = "f8"; -static const char *config_key_f9 = "f9"; -static const char *config_key_f10 = "f10"; -static const char *config_key_f11 = "f11"; -static const char *config_key_f12 = "f12"; -static const char *config_key_f13 = "f13"; -static const char *config_key_f14 = "f14"; -static const char *config_key_f15 = "f15"; -static const char *config_key_numlock = "numlock"; -static const char *config_key_capslock = "capslock"; -static const char *config_key_scrollock = "scrollock"; -static const char *config_key_rshift = "rshift"; -static const char *config_key_lshift = "lshift"; -static const char *config_key_rctrl = "rctrl"; -static const char *config_key_lctrl = "lctrl"; -static const char *config_key_ralt = "ralt"; -static const char *config_key_lalt = "lalt"; -static const char *config_key_rmeta = "rmeta"; -static const char *config_key_lmeta = "lmeta"; -static const char *config_key_lsuper = "lsuper"; -static const char *config_key_rsuper = "rsuper"; -static const char *config_key_mode = "mode"; -static const char *config_key_compose = "compose"; -static const char *config_key_help = "help"; -static const char *config_key_print = "print"; -static const char *config_key_sysreq = "sysreq"; -static const char *config_key_break = "break"; -static const char *config_key_menu = "menu"; -static const char *config_key_power = "power"; -static const char *config_key_euro = "euro"; -static const char *config_key_undo = "undo"; - static xmlDocPtr config_doc = NULL; static xmlNodePtr config_root = NULL; static char scratch[32] = ""; @@ -718,7 +483,7 @@ int config_read_event( xmlNode *node ) { /* Decode the key name if necessary */ if( tmp.device_type == DEV_KEYBOARD ) { - tmp.value = config_key( value ); + tmp.value = key_id( value ); if( tmp.value == 0 ) { fprintf( stderr, "Warning: Unknown key name '%s'\n", value ); return -1; @@ -1059,479 +824,3 @@ int config_init( const char *filename ) { return -1; } -int config_key( char *name ) { - if( name == NULL ) { - fprintf( stderr, "Warning: Null key name\n" ); - return -1; - } - if( strcasecmp( name, config_key_backspace ) == 0 )return SDLK_BACKSPACE; - else if( strcasecmp( name, config_key_tab ) == 0 )return SDLK_TAB; - else if( strcasecmp( name, config_key_clear ) == 0 )return SDLK_CLEAR; - else if( strcasecmp( name, config_key_return ) == 0 )return SDLK_RETURN; - else if( strcasecmp( name, config_key_pause ) == 0 )return SDLK_PAUSE; - else if( strcasecmp( name, config_key_escape ) == 0 )return SDLK_ESCAPE; - else if( strcasecmp( name, config_key_space ) == 0 )return SDLK_SPACE; - else if( strcasecmp( name, config_key_exclaim ) == 0 )return SDLK_EXCLAIM; - else if( strcasecmp( name, config_key_quotedbl ) == 0 )return SDLK_QUOTEDBL; - else if( strcasecmp( name, config_key_hash ) == 0 )return SDLK_HASH; - else if( strcasecmp( name, config_key_dollar ) == 0 )return SDLK_DOLLAR; - else if( strcasecmp( name, config_key_ampersand ) == 0 )return SDLK_AMPERSAND; - else if( strcasecmp( name, config_key_quote ) == 0 )return SDLK_QUOTE; - else if( strcasecmp( name, config_key_leftparen ) == 0 )return SDLK_LEFTPAREN; - else if( strcasecmp( name, config_key_rightparen ) == 0 )return SDLK_RIGHTPAREN; - else if( strcasecmp( name, config_key_asterisk ) == 0 )return SDLK_ASTERISK; - else if( strcasecmp( name, config_key_plus ) == 0 )return SDLK_PLUS; - else if( strcasecmp( name, config_key_comma ) == 0 )return SDLK_COMMA; - else if( strcasecmp( name, config_key_minus ) == 0 )return SDLK_MINUS; - else if( strcasecmp( name, config_key_period ) == 0 )return SDLK_PERIOD; - else if( strcasecmp( name, config_key_slash ) == 0 )return SDLK_SLASH; - else if( strcasecmp( name, config_key_0 ) == 0 )return SDLK_0; - else if( strcasecmp( name, config_key_1 ) == 0 )return SDLK_1; - else if( strcasecmp( name, config_key_2 ) == 0 )return SDLK_2; - else if( strcasecmp( name, config_key_3 ) == 0 )return SDLK_3; - else if( strcasecmp( name, config_key_4 ) == 0 )return SDLK_4; - else if( strcasecmp( name, config_key_5 ) == 0 )return SDLK_5; - else if( strcasecmp( name, config_key_6 ) == 0 )return SDLK_6; - else if( strcasecmp( name, config_key_7 ) == 0 )return SDLK_7; - else if( strcasecmp( name, config_key_8 ) == 0 )return SDLK_8; - else if( strcasecmp( name, config_key_9 ) == 0 )return SDLK_9; - else if( strcasecmp( name, config_key_colon ) == 0 )return SDLK_COLON; - else if( strcasecmp( name, config_key_semicolon ) == 0 )return SDLK_SEMICOLON; - else if( strcasecmp( name, config_key_less ) == 0 )return SDLK_LESS; - else if( strcasecmp( name, config_key_equals ) == 0 )return SDLK_EQUALS; - else if( strcasecmp( name, config_key_greater ) == 0 )return SDLK_GREATER; - else if( strcasecmp( name, config_key_question ) == 0 )return SDLK_QUESTION; - else if( strcasecmp( name, config_key_at ) == 0 )return SDLK_AT; - else if( strcasecmp( name, config_key_leftbracket ) == 0 )return SDLK_LEFTBRACKET; - else if( strcasecmp( name, config_key_backslash ) == 0 )return SDLK_BACKSLASH; - else if( strcasecmp( name, config_key_rightbracket ) == 0 )return SDLK_RIGHTBRACKET; - else if( strcasecmp( name, config_key_caret ) == 0 )return SDLK_CARET; - else if( strcasecmp( name, config_key_underscore ) == 0 )return SDLK_UNDERSCORE; - else if( strcasecmp( name, config_key_backquote ) == 0 )return SDLK_BACKQUOTE; - else if( strcasecmp( name, config_key_a ) == 0 )return SDLK_a; - else if( strcasecmp( name, config_key_b ) == 0 )return SDLK_b; - else if( strcasecmp( name, config_key_c ) == 0 )return SDLK_c; - else if( strcasecmp( name, config_key_d ) == 0 )return SDLK_d; - else if( strcasecmp( name, config_key_e ) == 0 )return SDLK_e; - else if( strcasecmp( name, config_key_f ) == 0 )return SDLK_f; - else if( strcasecmp( name, config_key_g ) == 0 )return SDLK_g; - else if( strcasecmp( name, config_key_h ) == 0 )return SDLK_h; - else if( strcasecmp( name, config_key_i ) == 0 )return SDLK_i; - else if( strcasecmp( name, config_key_j ) == 0 )return SDLK_j; - else if( strcasecmp( name, config_key_k ) == 0 )return SDLK_k; - else if( strcasecmp( name, config_key_l ) == 0 )return SDLK_l; - else if( strcasecmp( name, config_key_m ) == 0 )return SDLK_m; - else if( strcasecmp( name, config_key_n ) == 0 )return SDLK_n; - else if( strcasecmp( name, config_key_o ) == 0 )return SDLK_o; - else if( strcasecmp( name, config_key_p ) == 0 )return SDLK_p; - else if( strcasecmp( name, config_key_q ) == 0 )return SDLK_q; - else if( strcasecmp( name, config_key_r ) == 0 )return SDLK_r; - else if( strcasecmp( name, config_key_s ) == 0 )return SDLK_s; - else if( strcasecmp( name, config_key_t ) == 0 )return SDLK_t; - else if( strcasecmp( name, config_key_u ) == 0 )return SDLK_u; - else if( strcasecmp( name, config_key_v ) == 0 )return SDLK_v; - else if( strcasecmp( name, config_key_w ) == 0 )return SDLK_w; - else if( strcasecmp( name, config_key_x ) == 0 )return SDLK_x; - else if( strcasecmp( name, config_key_y ) == 0 )return SDLK_y; - else if( strcasecmp( name, config_key_z ) == 0 )return SDLK_z; - else if( strcasecmp( name, config_key_delete ) == 0 )return SDLK_DELETE; - else if( strcasecmp( name, config_key_world_0 ) == 0 )return SDLK_WORLD_0; - else if( strcasecmp( name, config_key_world_1 ) == 0 )return SDLK_WORLD_1; - else if( strcasecmp( name, config_key_world_2 ) == 0 )return SDLK_WORLD_2; - else if( strcasecmp( name, config_key_world_3 ) == 0 )return SDLK_WORLD_3; - else if( strcasecmp( name, config_key_world_4 ) == 0 )return SDLK_WORLD_4; - else if( strcasecmp( name, config_key_world_5 ) == 0 )return SDLK_WORLD_5; - else if( strcasecmp( name, config_key_world_6 ) == 0 )return SDLK_WORLD_6; - else if( strcasecmp( name, config_key_world_7 ) == 0 )return SDLK_WORLD_7; - else if( strcasecmp( name, config_key_world_8 ) == 0 )return SDLK_WORLD_8; - else if( strcasecmp( name, config_key_world_9 ) == 0 )return SDLK_WORLD_9; - else if( strcasecmp( name, config_key_world_10 ) == 0 )return SDLK_WORLD_10; - else if( strcasecmp( name, config_key_world_11 ) == 0 )return SDLK_WORLD_11; - else if( strcasecmp( name, config_key_world_12 ) == 0 )return SDLK_WORLD_12; - else if( strcasecmp( name, config_key_world_13 ) == 0 )return SDLK_WORLD_13; - else if( strcasecmp( name, config_key_world_14 ) == 0 )return SDLK_WORLD_14; - else if( strcasecmp( name, config_key_world_15 ) == 0 )return SDLK_WORLD_15; - else if( strcasecmp( name, config_key_world_16 ) == 0 )return SDLK_WORLD_16; - else if( strcasecmp( name, config_key_world_17 ) == 0 )return SDLK_WORLD_17; - else if( strcasecmp( name, config_key_world_18 ) == 0 )return SDLK_WORLD_18; - else if( strcasecmp( name, config_key_world_19 ) == 0 )return SDLK_WORLD_19; - else if( strcasecmp( name, config_key_world_20 ) == 0 )return SDLK_WORLD_20; - else if( strcasecmp( name, config_key_world_21 ) == 0 )return SDLK_WORLD_21; - else if( strcasecmp( name, config_key_world_22 ) == 0 )return SDLK_WORLD_22; - else if( strcasecmp( name, config_key_world_23 ) == 0 )return SDLK_WORLD_23; - else if( strcasecmp( name, config_key_world_24 ) == 0 )return SDLK_WORLD_24; - else if( strcasecmp( name, config_key_world_25 ) == 0 )return SDLK_WORLD_25; - else if( strcasecmp( name, config_key_world_26 ) == 0 )return SDLK_WORLD_26; - else if( strcasecmp( name, config_key_world_27 ) == 0 )return SDLK_WORLD_27; - else if( strcasecmp( name, config_key_world_28 ) == 0 )return SDLK_WORLD_28; - else if( strcasecmp( name, config_key_world_29 ) == 0 )return SDLK_WORLD_29; - else if( strcasecmp( name, config_key_world_30 ) == 0 )return SDLK_WORLD_30; - else if( strcasecmp( name, config_key_world_31 ) == 0 )return SDLK_WORLD_31; - else if( strcasecmp( name, config_key_world_32 ) == 0 )return SDLK_WORLD_32; - else if( strcasecmp( name, config_key_world_33 ) == 0 )return SDLK_WORLD_33; - else if( strcasecmp( name, config_key_world_34 ) == 0 )return SDLK_WORLD_34; - else if( strcasecmp( name, config_key_world_35 ) == 0 )return SDLK_WORLD_35; - else if( strcasecmp( name, config_key_world_36 ) == 0 )return SDLK_WORLD_36; - else if( strcasecmp( name, config_key_world_37 ) == 0 )return SDLK_WORLD_37; - else if( strcasecmp( name, config_key_world_38 ) == 0 )return SDLK_WORLD_38; - else if( strcasecmp( name, config_key_world_39 ) == 0 )return SDLK_WORLD_39; - else if( strcasecmp( name, config_key_world_40 ) == 0 )return SDLK_WORLD_40; - else if( strcasecmp( name, config_key_world_41 ) == 0 )return SDLK_WORLD_41; - else if( strcasecmp( name, config_key_world_42 ) == 0 )return SDLK_WORLD_42; - else if( strcasecmp( name, config_key_world_43 ) == 0 )return SDLK_WORLD_43; - else if( strcasecmp( name, config_key_world_44 ) == 0 )return SDLK_WORLD_44; - else if( strcasecmp( name, config_key_world_45 ) == 0 )return SDLK_WORLD_45; - else if( strcasecmp( name, config_key_world_46 ) == 0 )return SDLK_WORLD_46; - else if( strcasecmp( name, config_key_world_47 ) == 0 )return SDLK_WORLD_47; - else if( strcasecmp( name, config_key_world_48 ) == 0 )return SDLK_WORLD_48; - else if( strcasecmp( name, config_key_world_49 ) == 0 )return SDLK_WORLD_49; - else if( strcasecmp( name, config_key_world_50 ) == 0 )return SDLK_WORLD_50; - else if( strcasecmp( name, config_key_world_51 ) == 0 )return SDLK_WORLD_51; - else if( strcasecmp( name, config_key_world_52 ) == 0 )return SDLK_WORLD_52; - else if( strcasecmp( name, config_key_world_53 ) == 0 )return SDLK_WORLD_53; - else if( strcasecmp( name, config_key_world_54 ) == 0 )return SDLK_WORLD_54; - else if( strcasecmp( name, config_key_world_55 ) == 0 )return SDLK_WORLD_55; - else if( strcasecmp( name, config_key_world_56 ) == 0 )return SDLK_WORLD_56; - else if( strcasecmp( name, config_key_world_57 ) == 0 )return SDLK_WORLD_57; - else if( strcasecmp( name, config_key_world_58 ) == 0 )return SDLK_WORLD_58; - else if( strcasecmp( name, config_key_world_59 ) == 0 )return SDLK_WORLD_59; - else if( strcasecmp( name, config_key_world_60 ) == 0 )return SDLK_WORLD_60; - else if( strcasecmp( name, config_key_world_61 ) == 0 )return SDLK_WORLD_61; - else if( strcasecmp( name, config_key_world_62 ) == 0 )return SDLK_WORLD_62; - else if( strcasecmp( name, config_key_world_63 ) == 0 )return SDLK_WORLD_63; - else if( strcasecmp( name, config_key_world_64 ) == 0 )return SDLK_WORLD_64; - else if( strcasecmp( name, config_key_world_65 ) == 0 )return SDLK_WORLD_65; - else if( strcasecmp( name, config_key_world_66 ) == 0 )return SDLK_WORLD_66; - else if( strcasecmp( name, config_key_world_67 ) == 0 )return SDLK_WORLD_67; - else if( strcasecmp( name, config_key_world_68 ) == 0 )return SDLK_WORLD_68; - else if( strcasecmp( name, config_key_world_69 ) == 0 )return SDLK_WORLD_69; - else if( strcasecmp( name, config_key_world_70 ) == 0 )return SDLK_WORLD_70; - else if( strcasecmp( name, config_key_world_71 ) == 0 )return SDLK_WORLD_71; - else if( strcasecmp( name, config_key_world_72 ) == 0 )return SDLK_WORLD_72; - else if( strcasecmp( name, config_key_world_73 ) == 0 )return SDLK_WORLD_73; - else if( strcasecmp( name, config_key_world_74 ) == 0 )return SDLK_WORLD_74; - else if( strcasecmp( name, config_key_world_75 ) == 0 )return SDLK_WORLD_75; - else if( strcasecmp( name, config_key_world_76 ) == 0 )return SDLK_WORLD_76; - else if( strcasecmp( name, config_key_world_77 ) == 0 )return SDLK_WORLD_77; - else if( strcasecmp( name, config_key_world_78 ) == 0 )return SDLK_WORLD_78; - else if( strcasecmp( name, config_key_world_79 ) == 0 )return SDLK_WORLD_79; - else if( strcasecmp( name, config_key_world_80 ) == 0 )return SDLK_WORLD_80; - else if( strcasecmp( name, config_key_world_81 ) == 0 )return SDLK_WORLD_81; - else if( strcasecmp( name, config_key_world_82 ) == 0 )return SDLK_WORLD_82; - else if( strcasecmp( name, config_key_world_83 ) == 0 )return SDLK_WORLD_83; - else if( strcasecmp( name, config_key_world_84 ) == 0 )return SDLK_WORLD_84; - else if( strcasecmp( name, config_key_world_85 ) == 0 )return SDLK_WORLD_85; - else if( strcasecmp( name, config_key_world_86 ) == 0 )return SDLK_WORLD_86; - else if( strcasecmp( name, config_key_world_87 ) == 0 )return SDLK_WORLD_87; - else if( strcasecmp( name, config_key_world_88 ) == 0 )return SDLK_WORLD_88; - else if( strcasecmp( name, config_key_world_89 ) == 0 )return SDLK_WORLD_89; - else if( strcasecmp( name, config_key_world_90 ) == 0 )return SDLK_WORLD_90; - else if( strcasecmp( name, config_key_world_91 ) == 0 )return SDLK_WORLD_91; - else if( strcasecmp( name, config_key_world_92 ) == 0 )return SDLK_WORLD_92; - else if( strcasecmp( name, config_key_world_93 ) == 0 )return SDLK_WORLD_93; - else if( strcasecmp( name, config_key_world_94 ) == 0 )return SDLK_WORLD_94; - else if( strcasecmp( name, config_key_world_95 ) == 0 )return SDLK_WORLD_95; - else if( strcasecmp( name, config_key_kp0 ) == 0 )return SDLK_KP0; - else if( strcasecmp( name, config_key_kp1 ) == 0 )return SDLK_KP1; - else if( strcasecmp( name, config_key_kp2 ) == 0 )return SDLK_KP2; - else if( strcasecmp( name, config_key_kp3 ) == 0 )return SDLK_KP3; - else if( strcasecmp( name, config_key_kp4 ) == 0 )return SDLK_KP4; - else if( strcasecmp( name, config_key_kp5 ) == 0 )return SDLK_KP5; - else if( strcasecmp( name, config_key_kp6 ) == 0 )return SDLK_KP6; - else if( strcasecmp( name, config_key_kp7 ) == 0 )return SDLK_KP7; - else if( strcasecmp( name, config_key_kp8 ) == 0 )return SDLK_KP8; - else if( strcasecmp( name, config_key_kp9 ) == 0 )return SDLK_KP9; - else if( strcasecmp( name, config_key_kp_period ) == 0 )return SDLK_KP_PERIOD; - else if( strcasecmp( name, config_key_kp_divide ) == 0 )return SDLK_KP_DIVIDE; - else if( strcasecmp( name, config_key_kp_multiply ) == 0 )return SDLK_KP_MULTIPLY; - else if( strcasecmp( name, config_key_kp_minus ) == 0 )return SDLK_KP_MINUS; - else if( strcasecmp( name, config_key_kp_plus ) == 0 )return SDLK_KP_PLUS; - else if( strcasecmp( name, config_key_kp_enter ) == 0 )return SDLK_KP_ENTER; - else if( strcasecmp( name, config_key_kp_equals ) == 0 )return SDLK_KP_EQUALS; - else if( strcasecmp( name, config_key_up ) == 0 )return SDLK_UP; - else if( strcasecmp( name, config_key_down ) == 0 )return SDLK_DOWN; - else if( strcasecmp( name, config_key_right ) == 0 )return SDLK_RIGHT; - else if( strcasecmp( name, config_key_left ) == 0 )return SDLK_LEFT; - else if( strcasecmp( name, config_key_insert ) == 0 )return SDLK_INSERT; - else if( strcasecmp( name, config_key_home ) == 0 )return SDLK_HOME; - else if( strcasecmp( name, config_key_end ) == 0 )return SDLK_END; - else if( strcasecmp( name, config_key_pageup ) == 0 )return SDLK_PAGEUP; - else if( strcasecmp( name, config_key_pagedown ) == 0 )return SDLK_PAGEDOWN; - else if( strcasecmp( name, config_key_f1 ) == 0 )return SDLK_F1; - else if( strcasecmp( name, config_key_f2 ) == 0 )return SDLK_F2; - else if( strcasecmp( name, config_key_f3 ) == 0 )return SDLK_F3; - else if( strcasecmp( name, config_key_f4 ) == 0 )return SDLK_F4; - else if( strcasecmp( name, config_key_f5 ) == 0 )return SDLK_F5; - else if( strcasecmp( name, config_key_f6 ) == 0 )return SDLK_F6; - else if( strcasecmp( name, config_key_f7 ) == 0 )return SDLK_F7; - else if( strcasecmp( name, config_key_f8 ) == 0 )return SDLK_F8; - else if( strcasecmp( name, config_key_f9 ) == 0 )return SDLK_F9; - else if( strcasecmp( name, config_key_f10 ) == 0 )return SDLK_F10; - else if( strcasecmp( name, config_key_f11 ) == 0 )return SDLK_F11; - else if( strcasecmp( name, config_key_f12 ) == 0 )return SDLK_F12; - else if( strcasecmp( name, config_key_f13 ) == 0 )return SDLK_F13; - else if( strcasecmp( name, config_key_f14 ) == 0 )return SDLK_F14; - else if( strcasecmp( name, config_key_f15 ) == 0 )return SDLK_F15; - else if( strcasecmp( name, config_key_numlock ) == 0 )return SDLK_NUMLOCK; - else if( strcasecmp( name, config_key_capslock ) == 0 )return SDLK_CAPSLOCK; - else if( strcasecmp( name, config_key_scrollock ) == 0 )return SDLK_SCROLLOCK; - else if( strcasecmp( name, config_key_rshift ) == 0 )return SDLK_RSHIFT; - else if( strcasecmp( name, config_key_lshift ) == 0 )return SDLK_LSHIFT; - else if( strcasecmp( name, config_key_rctrl ) == 0 )return SDLK_RCTRL; - else if( strcasecmp( name, config_key_lctrl ) == 0 )return SDLK_LCTRL; - else if( strcasecmp( name, config_key_ralt ) == 0 )return SDLK_RALT; - else if( strcasecmp( name, config_key_lalt ) == 0 )return SDLK_LALT; - else if( strcasecmp( name, config_key_rmeta ) == 0 )return SDLK_RMETA; - else if( strcasecmp( name, config_key_lmeta ) == 0 )return SDLK_LMETA; - else if( strcasecmp( name, config_key_lsuper ) == 0 )return SDLK_LSUPER; - else if( strcasecmp( name, config_key_rsuper ) == 0 )return SDLK_RSUPER; - else if( strcasecmp( name, config_key_mode ) == 0 )return SDLK_MODE; - else if( strcasecmp( name, config_key_compose ) == 0 )return SDLK_COMPOSE; - else if( strcasecmp( name, config_key_help ) == 0 )return SDLK_HELP; - else if( strcasecmp( name, config_key_print ) == 0 )return SDLK_PRINT; - else if( strcasecmp( name, config_key_sysreq ) == 0 )return SDLK_SYSREQ; - else if( strcasecmp( name, config_key_break ) == 0 )return SDLK_BREAK; - else if( strcasecmp( name, config_key_menu ) == 0 )return SDLK_MENU; - else if( strcasecmp( name, config_key_power ) == 0 )return SDLK_POWER; - else if( strcasecmp( name, config_key_euro ) == 0 )return SDLK_EURO; - else if( strcasecmp( name, config_key_undo ) == 0 )return SDLK_UNDO; - return 0; -} - -const char *config_key_name( int key ) { - switch( key ) { - case SDLK_BACKSPACE: return config_key_backspace; - case SDLK_TAB: return config_key_tab; - case SDLK_CLEAR: return config_key_clear; - case SDLK_RETURN: return config_key_return; - case SDLK_PAUSE: return config_key_pause; - case SDLK_ESCAPE: return config_key_escape; - case SDLK_SPACE: return config_key_space; - case SDLK_EXCLAIM: return config_key_exclaim; - case SDLK_QUOTEDBL: return config_key_quotedbl; - case SDLK_HASH: return config_key_hash; - case SDLK_DOLLAR: return config_key_dollar; - case SDLK_AMPERSAND: return config_key_ampersand; - case SDLK_QUOTE: return config_key_quote; - case SDLK_LEFTPAREN: return config_key_leftparen; - case SDLK_RIGHTPAREN: return config_key_rightparen; - case SDLK_ASTERISK: return config_key_asterisk; - case SDLK_PLUS: return config_key_plus; - case SDLK_COMMA: return config_key_comma; - case SDLK_MINUS: return config_key_minus; - case SDLK_PERIOD: return config_key_period; - case SDLK_SLASH: return config_key_slash; - case SDLK_0: return config_key_0; - case SDLK_1: return config_key_1; - case SDLK_2: return config_key_2; - case SDLK_3: return config_key_3; - case SDLK_4: return config_key_4; - case SDLK_5: return config_key_5; - case SDLK_6: return config_key_6; - case SDLK_7: return config_key_7; - case SDLK_8: return config_key_8; - case SDLK_9: return config_key_9; - case SDLK_COLON: return config_key_colon; - case SDLK_SEMICOLON: return config_key_semicolon; - case SDLK_LESS: return config_key_less; - case SDLK_EQUALS: return config_key_equals; - case SDLK_GREATER: return config_key_greater; - case SDLK_QUESTION: return config_key_question; - case SDLK_AT: return config_key_at; - case SDLK_LEFTBRACKET: return config_key_leftbracket; - case SDLK_BACKSLASH: return config_key_backslash; - case SDLK_RIGHTBRACKET: return config_key_rightbracket; - case SDLK_CARET: return config_key_caret; - case SDLK_UNDERSCORE: return config_key_underscore; - case SDLK_BACKQUOTE: return config_key_backquote; - case SDLK_a: return config_key_a; - case SDLK_b: return config_key_b; - case SDLK_c: return config_key_c; - case SDLK_d: return config_key_d; - case SDLK_e: return config_key_e; - case SDLK_f: return config_key_f; - case SDLK_g: return config_key_g; - case SDLK_h: return config_key_h; - case SDLK_i: return config_key_i; - case SDLK_j: return config_key_j; - case SDLK_k: return config_key_k; - case SDLK_l: return config_key_l; - case SDLK_m: return config_key_m; - case SDLK_n: return config_key_n; - case SDLK_o: return config_key_o; - case SDLK_p: return config_key_p; - case SDLK_q: return config_key_q; - case SDLK_r: return config_key_r; - case SDLK_s: return config_key_s; - case SDLK_t: return config_key_t; - case SDLK_u: return config_key_u; - case SDLK_v: return config_key_v; - case SDLK_w: return config_key_w; - case SDLK_x: return config_key_x; - case SDLK_y: return config_key_y; - case SDLK_z: return config_key_z; - case SDLK_DELETE: return config_key_delete; - case SDLK_WORLD_0: return config_key_world_0; - case SDLK_WORLD_1: return config_key_world_1; - case SDLK_WORLD_2: return config_key_world_2; - case SDLK_WORLD_3: return config_key_world_3; - case SDLK_WORLD_4: return config_key_world_4; - case SDLK_WORLD_5: return config_key_world_5; - case SDLK_WORLD_6: return config_key_world_6; - case SDLK_WORLD_7: return config_key_world_7; - case SDLK_WORLD_8: return config_key_world_8; - case SDLK_WORLD_9: return config_key_world_9; - case SDLK_WORLD_10: return config_key_world_10; - case SDLK_WORLD_11: return config_key_world_11; - case SDLK_WORLD_12: return config_key_world_12; - case SDLK_WORLD_13: return config_key_world_13; - case SDLK_WORLD_14: return config_key_world_14; - case SDLK_WORLD_15: return config_key_world_15; - case SDLK_WORLD_16: return config_key_world_16; - case SDLK_WORLD_17: return config_key_world_17; - case SDLK_WORLD_18: return config_key_world_18; - case SDLK_WORLD_19: return config_key_world_19; - case SDLK_WORLD_20: return config_key_world_20; - case SDLK_WORLD_21: return config_key_world_21; - case SDLK_WORLD_22: return config_key_world_22; - case SDLK_WORLD_23: return config_key_world_23; - case SDLK_WORLD_24: return config_key_world_24; - case SDLK_WORLD_25: return config_key_world_25; - case SDLK_WORLD_26: return config_key_world_26; - case SDLK_WORLD_27: return config_key_world_27; - case SDLK_WORLD_28: return config_key_world_28; - case SDLK_WORLD_29: return config_key_world_29; - case SDLK_WORLD_30: return config_key_world_30; - case SDLK_WORLD_31: return config_key_world_31; - case SDLK_WORLD_32: return config_key_world_32; - case SDLK_WORLD_33: return config_key_world_33; - case SDLK_WORLD_34: return config_key_world_34; - case SDLK_WORLD_35: return config_key_world_35; - case SDLK_WORLD_36: return config_key_world_36; - case SDLK_WORLD_37: return config_key_world_37; - case SDLK_WORLD_38: return config_key_world_38; - case SDLK_WORLD_39: return config_key_world_39; - case SDLK_WORLD_40: return config_key_world_40; - case SDLK_WORLD_41: return config_key_world_41; - case SDLK_WORLD_42: return config_key_world_42; - case SDLK_WORLD_43: return config_key_world_43; - case SDLK_WORLD_44: return config_key_world_44; - case SDLK_WORLD_45: return config_key_world_45; - case SDLK_WORLD_46: return config_key_world_46; - case SDLK_WORLD_47: return config_key_world_47; - case SDLK_WORLD_48: return config_key_world_48; - case SDLK_WORLD_49: return config_key_world_49; - case SDLK_WORLD_50: return config_key_world_50; - case SDLK_WORLD_51: return config_key_world_51; - case SDLK_WORLD_52: return config_key_world_52; - case SDLK_WORLD_53: return config_key_world_53; - case SDLK_WORLD_54: return config_key_world_54; - case SDLK_WORLD_55: return config_key_world_55; - case SDLK_WORLD_56: return config_key_world_56; - case SDLK_WORLD_57: return config_key_world_57; - case SDLK_WORLD_58: return config_key_world_58; - case SDLK_WORLD_59: return config_key_world_59; - case SDLK_WORLD_60: return config_key_world_60; - case SDLK_WORLD_61: return config_key_world_61; - case SDLK_WORLD_62: return config_key_world_62; - case SDLK_WORLD_63: return config_key_world_63; - case SDLK_WORLD_64: return config_key_world_64; - case SDLK_WORLD_65: return config_key_world_65; - case SDLK_WORLD_66: return config_key_world_66; - case SDLK_WORLD_67: return config_key_world_67; - case SDLK_WORLD_68: return config_key_world_68; - case SDLK_WORLD_69: return config_key_world_69; - case SDLK_WORLD_70: return config_key_world_70; - case SDLK_WORLD_71: return config_key_world_71; - case SDLK_WORLD_72: return config_key_world_72; - case SDLK_WORLD_73: return config_key_world_73; - case SDLK_WORLD_74: return config_key_world_74; - case SDLK_WORLD_75: return config_key_world_75; - case SDLK_WORLD_76: return config_key_world_76; - case SDLK_WORLD_77: return config_key_world_77; - case SDLK_WORLD_78: return config_key_world_78; - case SDLK_WORLD_79: return config_key_world_79; - case SDLK_WORLD_80: return config_key_world_80; - case SDLK_WORLD_81: return config_key_world_81; - case SDLK_WORLD_82: return config_key_world_82; - case SDLK_WORLD_83: return config_key_world_83; - case SDLK_WORLD_84: return config_key_world_84; - case SDLK_WORLD_85: return config_key_world_85; - case SDLK_WORLD_86: return config_key_world_86; - case SDLK_WORLD_87: return config_key_world_87; - case SDLK_WORLD_88: return config_key_world_88; - case SDLK_WORLD_89: return config_key_world_89; - case SDLK_WORLD_90: return config_key_world_90; - case SDLK_WORLD_91: return config_key_world_91; - case SDLK_WORLD_92: return config_key_world_92; - case SDLK_WORLD_93: return config_key_world_93; - case SDLK_WORLD_94: return config_key_world_94; - case SDLK_WORLD_95: return config_key_world_95; - case SDLK_KP0: return config_key_kp0; - case SDLK_KP1: return config_key_kp1; - case SDLK_KP2: return config_key_kp2; - case SDLK_KP3: return config_key_kp3; - case SDLK_KP4: return config_key_kp4; - case SDLK_KP5: return config_key_kp5; - case SDLK_KP6: return config_key_kp6; - case SDLK_KP7: return config_key_kp7; - case SDLK_KP8: return config_key_kp8; - case SDLK_KP9: return config_key_kp9; - case SDLK_KP_PERIOD: return config_key_kp_period; - case SDLK_KP_DIVIDE: return config_key_kp_divide; - case SDLK_KP_MULTIPLY: return config_key_kp_multiply; - case SDLK_KP_MINUS: return config_key_kp_minus; - case SDLK_KP_PLUS: return config_key_kp_plus; - case SDLK_KP_ENTER: return config_key_kp_enter; - case SDLK_KP_EQUALS: return config_key_kp_equals; - case SDLK_UP: return config_key_up; - case SDLK_DOWN: return config_key_down; - case SDLK_RIGHT: return config_key_right; - case SDLK_LEFT: return config_key_left; - case SDLK_INSERT: return config_key_insert; - case SDLK_HOME: return config_key_home; - case SDLK_END: return config_key_end; - case SDLK_PAGEUP: return config_key_pageup; - case SDLK_PAGEDOWN: return config_key_pagedown; - case SDLK_F1: return config_key_f1; - case SDLK_F2: return config_key_f2; - case SDLK_F3: return config_key_f3; - case SDLK_F4: return config_key_f4; - case SDLK_F5: return config_key_f5; - case SDLK_F6: return config_key_f6; - case SDLK_F7: return config_key_f7; - case SDLK_F8: return config_key_f8; - case SDLK_F9: return config_key_f9; - case SDLK_F10: return config_key_f10; - case SDLK_F11: return config_key_f11; - case SDLK_F12: return config_key_f12; - case SDLK_F13: return config_key_f13; - case SDLK_F14: return config_key_f14; - case SDLK_F15: return config_key_f15; - case SDLK_NUMLOCK: return config_key_numlock; - case SDLK_CAPSLOCK: return config_key_capslock; - case SDLK_SCROLLOCK: return config_key_scrollock; - case SDLK_RSHIFT: return config_key_rshift; - case SDLK_LSHIFT: return config_key_lshift; - case SDLK_RCTRL: return config_key_rctrl; - case SDLK_LCTRL: return config_key_lctrl; - case SDLK_RALT: return config_key_ralt; - case SDLK_LALT: return config_key_lalt; - case SDLK_RMETA: return config_key_rmeta; - case SDLK_LMETA: return config_key_lmeta; - case SDLK_LSUPER: return config_key_lsuper; - case SDLK_RSUPER: return config_key_rsuper; - case SDLK_MODE: return config_key_mode; - case SDLK_COMPOSE: return config_key_compose; - case SDLK_HELP: return config_key_help; - case SDLK_PRINT: return config_key_print; - case SDLK_SYSREQ: return config_key_sysreq; - case SDLK_BREAK: return config_key_break; - case SDLK_MENU: return config_key_menu; - case SDLK_POWER: return config_key_power; - case SDLK_EURO: return config_key_euro; - case SDLK_UNDO: return config_key_undo; - } - return NULL; -} - diff --git a/include/key.h b/include/key.h new file mode 100644 index 0000000..3d7c64e --- /dev/null +++ b/include/key.h @@ -0,0 +1,8 @@ +#ifndef _KEY_H_ +#define _KEY_H_ 1 + +int key_id( char *name ); +const char *key_name( int key ); + +#endif + diff --git a/key.c b/key.c new file mode 100644 index 0000000..7257056 --- /dev/null +++ b/key.c @@ -0,0 +1,712 @@ +#include "key.h" +#include "sdl.h" + +/* Big list o' key names. These are just the SDLK_* macros with their prefix chopped off. */ +static const char *key_name_backspace = "backspace"; +static const char *key_name_tab = "tab"; +static const char *key_name_clear = "clear"; +static const char *key_name_return = "return"; +static const char *key_name_pause = "pause"; +static const char *key_name_escape = "escape"; +static const char *key_name_space = "space"; +static const char *key_name_exclaim = "exclaim"; +static const char *key_name_quotedbl = "quotedbl"; +static const char *key_name_hash = "hash"; +static const char *key_name_dollar = "dollar"; +static const char *key_name_ampersand = "ampersand"; +static const char *key_name_quote = "quote"; +static const char *key_name_leftparen = "leftparen"; +static const char *key_name_rightparen = "rightparen"; +static const char *key_name_asterisk = "asterisk"; +static const char *key_name_plus = "plus"; +static const char *key_name_comma = "comma"; +static const char *key_name_minus = "minus"; +static const char *key_name_period = "period"; +static const char *key_name_slash = "slash"; +static const char *key_name_0 = "0"; +static const char *key_name_1 = "1"; +static const char *key_name_2 = "2"; +static const char *key_name_3 = "3"; +static const char *key_name_4 = "4"; +static const char *key_name_5 = "5"; +static const char *key_name_6 = "6"; +static const char *key_name_7 = "7"; +static const char *key_name_8 = "8"; +static const char *key_name_9 = "9"; +static const char *key_name_colon = "colon"; +static const char *key_name_semicolon = "semicolon"; +static const char *key_name_less = "less"; +static const char *key_name_equals = "equals"; +static const char *key_name_greater = "greater"; +static const char *key_name_question = "question"; +static const char *key_name_at = "at"; +static const char *key_name_leftbracket = "leftbracket"; +static const char *key_name_backslash = "backslash"; +static const char *key_name_rightbracket = "rightbracket"; +static const char *key_name_caret = "caret"; +static const char *key_name_underscore = "underscore"; +static const char *key_name_backquote = "backquote"; +static const char *key_name_a = "a"; +static const char *key_name_b = "b"; +static const char *key_name_c = "c"; +static const char *key_name_d = "d"; +static const char *key_name_e = "e"; +static const char *key_name_f = "f"; +static const char *key_name_g = "g"; +static const char *key_name_h = "h"; +static const char *key_name_i = "i"; +static const char *key_name_j = "j"; +static const char *key_name_k = "k"; +static const char *key_name_l = "l"; +static const char *key_name_m = "m"; +static const char *key_name_n = "n"; +static const char *key_name_o = "o"; +static const char *key_name_p = "p"; +static const char *key_name_q = "q"; +static const char *key_name_r = "r"; +static const char *key_name_s = "s"; +static const char *key_name_t = "t"; +static const char *key_name_u = "u"; +static const char *key_name_v = "v"; +static const char *key_name_w = "w"; +static const char *key_name_x = "x"; +static const char *key_name_y = "y"; +static const char *key_name_z = "z"; +static const char *key_name_delete = "delete"; +static const char *key_name_world_0 = "world_0"; +static const char *key_name_world_1 = "world_1"; +static const char *key_name_world_2 = "world_2"; +static const char *key_name_world_3 = "world_3"; +static const char *key_name_world_4 = "world_4"; +static const char *key_name_world_5 = "world_5"; +static const char *key_name_world_6 = "world_6"; +static const char *key_name_world_7 = "world_7"; +static const char *key_name_world_8 = "world_8"; +static const char *key_name_world_9 = "world_9"; +static const char *key_name_world_10 = "world_10"; +static const char *key_name_world_11 = "world_11"; +static const char *key_name_world_12 = "world_12"; +static const char *key_name_world_13 = "world_13"; +static const char *key_name_world_14 = "world_14"; +static const char *key_name_world_15 = "world_15"; +static const char *key_name_world_16 = "world_16"; +static const char *key_name_world_17 = "world_17"; +static const char *key_name_world_18 = "world_18"; +static const char *key_name_world_19 = "world_19"; +static const char *key_name_world_20 = "world_20"; +static const char *key_name_world_21 = "world_21"; +static const char *key_name_world_22 = "world_22"; +static const char *key_name_world_23 = "world_23"; +static const char *key_name_world_24 = "world_24"; +static const char *key_name_world_25 = "world_25"; +static const char *key_name_world_26 = "world_26"; +static const char *key_name_world_27 = "world_27"; +static const char *key_name_world_28 = "world_28"; +static const char *key_name_world_29 = "world_29"; +static const char *key_name_world_30 = "world_30"; +static const char *key_name_world_31 = "world_31"; +static const char *key_name_world_32 = "world_32"; +static const char *key_name_world_33 = "world_33"; +static const char *key_name_world_34 = "world_34"; +static const char *key_name_world_35 = "world_35"; +static const char *key_name_world_36 = "world_36"; +static const char *key_name_world_37 = "world_37"; +static const char *key_name_world_38 = "world_38"; +static const char *key_name_world_39 = "world_39"; +static const char *key_name_world_40 = "world_40"; +static const char *key_name_world_41 = "world_41"; +static const char *key_name_world_42 = "world_42"; +static const char *key_name_world_43 = "world_43"; +static const char *key_name_world_44 = "world_44"; +static const char *key_name_world_45 = "world_45"; +static const char *key_name_world_46 = "world_46"; +static const char *key_name_world_47 = "world_47"; +static const char *key_name_world_48 = "world_48"; +static const char *key_name_world_49 = "world_49"; +static const char *key_name_world_50 = "world_50"; +static const char *key_name_world_51 = "world_51"; +static const char *key_name_world_52 = "world_52"; +static const char *key_name_world_53 = "world_53"; +static const char *key_name_world_54 = "world_54"; +static const char *key_name_world_55 = "world_55"; +static const char *key_name_world_56 = "world_56"; +static const char *key_name_world_57 = "world_57"; +static const char *key_name_world_58 = "world_58"; +static const char *key_name_world_59 = "world_59"; +static const char *key_name_world_60 = "world_60"; +static const char *key_name_world_61 = "world_61"; +static const char *key_name_world_62 = "world_62"; +static const char *key_name_world_63 = "world_63"; +static const char *key_name_world_64 = "world_64"; +static const char *key_name_world_65 = "world_65"; +static const char *key_name_world_66 = "world_66"; +static const char *key_name_world_67 = "world_67"; +static const char *key_name_world_68 = "world_68"; +static const char *key_name_world_69 = "world_69"; +static const char *key_name_world_70 = "world_70"; +static const char *key_name_world_71 = "world_71"; +static const char *key_name_world_72 = "world_72"; +static const char *key_name_world_73 = "world_73"; +static const char *key_name_world_74 = "world_74"; +static const char *key_name_world_75 = "world_75"; +static const char *key_name_world_76 = "world_76"; +static const char *key_name_world_77 = "world_77"; +static const char *key_name_world_78 = "world_78"; +static const char *key_name_world_79 = "world_79"; +static const char *key_name_world_80 = "world_80"; +static const char *key_name_world_81 = "world_81"; +static const char *key_name_world_82 = "world_82"; +static const char *key_name_world_83 = "world_83"; +static const char *key_name_world_84 = "world_84"; +static const char *key_name_world_85 = "world_85"; +static const char *key_name_world_86 = "world_86"; +static const char *key_name_world_87 = "world_87"; +static const char *key_name_world_88 = "world_88"; +static const char *key_name_world_89 = "world_89"; +static const char *key_name_world_90 = "world_90"; +static const char *key_name_world_91 = "world_91"; +static const char *key_name_world_92 = "world_92"; +static const char *key_name_world_93 = "world_93"; +static const char *key_name_world_94 = "world_94"; +static const char *key_name_world_95 = "world_95"; +static const char *key_name_kp0 = "kp0"; +static const char *key_name_kp1 = "kp1"; +static const char *key_name_kp2 = "kp2"; +static const char *key_name_kp3 = "kp3"; +static const char *key_name_kp4 = "kp4"; +static const char *key_name_kp5 = "kp5"; +static const char *key_name_kp6 = "kp6"; +static const char *key_name_kp7 = "kp7"; +static const char *key_name_kp8 = "kp8"; +static const char *key_name_kp9 = "kp9"; +static const char *key_name_kp_period = "kp_period"; +static const char *key_name_kp_divide = "kp_divide"; +static const char *key_name_kp_multiply = "kp_multiply"; +static const char *key_name_kp_minus = "kp_minus"; +static const char *key_name_kp_plus = "kp_plus"; +static const char *key_name_kp_enter = "kp_enter"; +static const char *key_name_kp_equals = "kp_equals"; +static const char *key_name_up = "up"; +static const char *key_name_down = "down"; +static const char *key_name_right = "right"; +static const char *key_name_left = "left"; +static const char *key_name_insert = "insert"; +static const char *key_name_home = "home"; +static const char *key_name_end = "end"; +static const char *key_name_pageup = "pageup"; +static const char *key_name_pagedown = "pagedown"; +static const char *key_name_f1 = "f1"; +static const char *key_name_f2 = "f2"; +static const char *key_name_f3 = "f3"; +static const char *key_name_f4 = "f4"; +static const char *key_name_f5 = "f5"; +static const char *key_name_f6 = "f6"; +static const char *key_name_f7 = "f7"; +static const char *key_name_f8 = "f8"; +static const char *key_name_f9 = "f9"; +static const char *key_name_f10 = "f10"; +static const char *key_name_f11 = "f11"; +static const char *key_name_f12 = "f12"; +static const char *key_name_f13 = "f13"; +static const char *key_name_f14 = "f14"; +static const char *key_name_f15 = "f15"; +static const char *key_name_numlock = "numlock"; +static const char *key_name_capslock = "capslock"; +static const char *key_name_scrollock = "scrollock"; +static const char *key_name_rshift = "rshift"; +static const char *key_name_lshift = "lshift"; +static const char *key_name_rctrl = "rctrl"; +static const char *key_name_lctrl = "lctrl"; +static const char *key_name_ralt = "ralt"; +static const char *key_name_lalt = "lalt"; +static const char *key_name_rmeta = "rmeta"; +static const char *key_name_lmeta = "lmeta"; +static const char *key_name_lsuper = "lsuper"; +static const char *key_name_rsuper = "rsuper"; +static const char *key_name_mode = "mode"; +static const char *key_name_compose = "compose"; +static const char *key_name_help = "help"; +static const char *key_name_print = "print"; +static const char *key_name_sysreq = "sysreq"; +static const char *key_name_break = "break"; +static const char *key_name_menu = "menu"; +static const char *key_name_power = "power"; +static const char *key_name_euro = "euro"; +static const char *key_name_undo = "undo"; + +int key_id( char *name ) { + if( name == NULL ) { + fprintf( stderr, "Warning: Null key name\n" ); + return -1; + } + if( strcasecmp( name, key_name_backspace ) == 0 )return SDLK_BACKSPACE; + else if( strcasecmp( name, key_name_tab ) == 0 )return SDLK_TAB; + else if( strcasecmp( name, key_name_clear ) == 0 )return SDLK_CLEAR; + else if( strcasecmp( name, key_name_return ) == 0 )return SDLK_RETURN; + else if( strcasecmp( name, key_name_pause ) == 0 )return SDLK_PAUSE; + else if( strcasecmp( name, key_name_escape ) == 0 )return SDLK_ESCAPE; + else if( strcasecmp( name, key_name_space ) == 0 )return SDLK_SPACE; + else if( strcasecmp( name, key_name_exclaim ) == 0 )return SDLK_EXCLAIM; + else if( strcasecmp( name, key_name_quotedbl ) == 0 )return SDLK_QUOTEDBL; + else if( strcasecmp( name, key_name_hash ) == 0 )return SDLK_HASH; + else if( strcasecmp( name, key_name_dollar ) == 0 )return SDLK_DOLLAR; + else if( strcasecmp( name, key_name_ampersand ) == 0 )return SDLK_AMPERSAND; + else if( strcasecmp( name, key_name_quote ) == 0 )return SDLK_QUOTE; + else if( strcasecmp( name, key_name_leftparen ) == 0 )return SDLK_LEFTPAREN; + else if( strcasecmp( name, key_name_rightparen ) == 0 )return SDLK_RIGHTPAREN; + else if( strcasecmp( name, key_name_asterisk ) == 0 )return SDLK_ASTERISK; + else if( strcasecmp( name, key_name_plus ) == 0 )return SDLK_PLUS; + else if( strcasecmp( name, key_name_comma ) == 0 )return SDLK_COMMA; + else if( strcasecmp( name, key_name_minus ) == 0 )return SDLK_MINUS; + else if( strcasecmp( name, key_name_period ) == 0 )return SDLK_PERIOD; + else if( strcasecmp( name, key_name_slash ) == 0 )return SDLK_SLASH; + else if( strcasecmp( name, key_name_0 ) == 0 )return SDLK_0; + else if( strcasecmp( name, key_name_1 ) == 0 )return SDLK_1; + else if( strcasecmp( name, key_name_2 ) == 0 )return SDLK_2; + else if( strcasecmp( name, key_name_3 ) == 0 )return SDLK_3; + else if( strcasecmp( name, key_name_4 ) == 0 )return SDLK_4; + else if( strcasecmp( name, key_name_5 ) == 0 )return SDLK_5; + else if( strcasecmp( name, key_name_6 ) == 0 )return SDLK_6; + else if( strcasecmp( name, key_name_7 ) == 0 )return SDLK_7; + else if( strcasecmp( name, key_name_8 ) == 0 )return SDLK_8; + else if( strcasecmp( name, key_name_9 ) == 0 )return SDLK_9; + else if( strcasecmp( name, key_name_colon ) == 0 )return SDLK_COLON; + else if( strcasecmp( name, key_name_semicolon ) == 0 )return SDLK_SEMICOLON; + else if( strcasecmp( name, key_name_less ) == 0 )return SDLK_LESS; + else if( strcasecmp( name, key_name_equals ) == 0 )return SDLK_EQUALS; + else if( strcasecmp( name, key_name_greater ) == 0 )return SDLK_GREATER; + else if( strcasecmp( name, key_name_question ) == 0 )return SDLK_QUESTION; + else if( strcasecmp( name, key_name_at ) == 0 )return SDLK_AT; + else if( strcasecmp( name, key_name_leftbracket ) == 0 )return SDLK_LEFTBRACKET; + else if( strcasecmp( name, key_name_backslash ) == 0 )return SDLK_BACKSLASH; + else if( strcasecmp( name, key_name_rightbracket ) == 0 )return SDLK_RIGHTBRACKET; + else if( strcasecmp( name, key_name_caret ) == 0 )return SDLK_CARET; + else if( strcasecmp( name, key_name_underscore ) == 0 )return SDLK_UNDERSCORE; + else if( strcasecmp( name, key_name_backquote ) == 0 )return SDLK_BACKQUOTE; + else if( strcasecmp( name, key_name_a ) == 0 )return SDLK_a; + else if( strcasecmp( name, key_name_b ) == 0 )return SDLK_b; + else if( strcasecmp( name, key_name_c ) == 0 )return SDLK_c; + else if( strcasecmp( name, key_name_d ) == 0 )return SDLK_d; + else if( strcasecmp( name, key_name_e ) == 0 )return SDLK_e; + else if( strcasecmp( name, key_name_f ) == 0 )return SDLK_f; + else if( strcasecmp( name, key_name_g ) == 0 )return SDLK_g; + else if( strcasecmp( name, key_name_h ) == 0 )return SDLK_h; + else if( strcasecmp( name, key_name_i ) == 0 )return SDLK_i; + else if( strcasecmp( name, key_name_j ) == 0 )return SDLK_j; + else if( strcasecmp( name, key_name_k ) == 0 )return SDLK_k; + else if( strcasecmp( name, key_name_l ) == 0 )return SDLK_l; + else if( strcasecmp( name, key_name_m ) == 0 )return SDLK_m; + else if( strcasecmp( name, key_name_n ) == 0 )return SDLK_n; + else if( strcasecmp( name, key_name_o ) == 0 )return SDLK_o; + else if( strcasecmp( name, key_name_p ) == 0 )return SDLK_p; + else if( strcasecmp( name, key_name_q ) == 0 )return SDLK_q; + else if( strcasecmp( name, key_name_r ) == 0 )return SDLK_r; + else if( strcasecmp( name, key_name_s ) == 0 )return SDLK_s; + else if( strcasecmp( name, key_name_t ) == 0 )return SDLK_t; + else if( strcasecmp( name, key_name_u ) == 0 )return SDLK_u; + else if( strcasecmp( name, key_name_v ) == 0 )return SDLK_v; + else if( strcasecmp( name, key_name_w ) == 0 )return SDLK_w; + else if( strcasecmp( name, key_name_x ) == 0 )return SDLK_x; + else if( strcasecmp( name, key_name_y ) == 0 )return SDLK_y; + else if( strcasecmp( name, key_name_z ) == 0 )return SDLK_z; + else if( strcasecmp( name, key_name_delete ) == 0 )return SDLK_DELETE; + else if( strcasecmp( name, key_name_world_0 ) == 0 )return SDLK_WORLD_0; + else if( strcasecmp( name, key_name_world_1 ) == 0 )return SDLK_WORLD_1; + else if( strcasecmp( name, key_name_world_2 ) == 0 )return SDLK_WORLD_2; + else if( strcasecmp( name, key_name_world_3 ) == 0 )return SDLK_WORLD_3; + else if( strcasecmp( name, key_name_world_4 ) == 0 )return SDLK_WORLD_4; + else if( strcasecmp( name, key_name_world_5 ) == 0 )return SDLK_WORLD_5; + else if( strcasecmp( name, key_name_world_6 ) == 0 )return SDLK_WORLD_6; + else if( strcasecmp( name, key_name_world_7 ) == 0 )return SDLK_WORLD_7; + else if( strcasecmp( name, key_name_world_8 ) == 0 )return SDLK_WORLD_8; + else if( strcasecmp( name, key_name_world_9 ) == 0 )return SDLK_WORLD_9; + else if( strcasecmp( name, key_name_world_10 ) == 0 )return SDLK_WORLD_10; + else if( strcasecmp( name, key_name_world_11 ) == 0 )return SDLK_WORLD_11; + else if( strcasecmp( name, key_name_world_12 ) == 0 )return SDLK_WORLD_12; + else if( strcasecmp( name, key_name_world_13 ) == 0 )return SDLK_WORLD_13; + else if( strcasecmp( name, key_name_world_14 ) == 0 )return SDLK_WORLD_14; + else if( strcasecmp( name, key_name_world_15 ) == 0 )return SDLK_WORLD_15; + else if( strcasecmp( name, key_name_world_16 ) == 0 )return SDLK_WORLD_16; + else if( strcasecmp( name, key_name_world_17 ) == 0 )return SDLK_WORLD_17; + else if( strcasecmp( name, key_name_world_18 ) == 0 )return SDLK_WORLD_18; + else if( strcasecmp( name, key_name_world_19 ) == 0 )return SDLK_WORLD_19; + else if( strcasecmp( name, key_name_world_20 ) == 0 )return SDLK_WORLD_20; + else if( strcasecmp( name, key_name_world_21 ) == 0 )return SDLK_WORLD_21; + else if( strcasecmp( name, key_name_world_22 ) == 0 )return SDLK_WORLD_22; + else if( strcasecmp( name, key_name_world_23 ) == 0 )return SDLK_WORLD_23; + else if( strcasecmp( name, key_name_world_24 ) == 0 )return SDLK_WORLD_24; + else if( strcasecmp( name, key_name_world_25 ) == 0 )return SDLK_WORLD_25; + else if( strcasecmp( name, key_name_world_26 ) == 0 )return SDLK_WORLD_26; + else if( strcasecmp( name, key_name_world_27 ) == 0 )return SDLK_WORLD_27; + else if( strcasecmp( name, key_name_world_28 ) == 0 )return SDLK_WORLD_28; + else if( strcasecmp( name, key_name_world_29 ) == 0 )return SDLK_WORLD_29; + else if( strcasecmp( name, key_name_world_30 ) == 0 )return SDLK_WORLD_30; + else if( strcasecmp( name, key_name_world_31 ) == 0 )return SDLK_WORLD_31; + else if( strcasecmp( name, key_name_world_32 ) == 0 )return SDLK_WORLD_32; + else if( strcasecmp( name, key_name_world_33 ) == 0 )return SDLK_WORLD_33; + else if( strcasecmp( name, key_name_world_34 ) == 0 )return SDLK_WORLD_34; + else if( strcasecmp( name, key_name_world_35 ) == 0 )return SDLK_WORLD_35; + else if( strcasecmp( name, key_name_world_36 ) == 0 )return SDLK_WORLD_36; + else if( strcasecmp( name, key_name_world_37 ) == 0 )return SDLK_WORLD_37; + else if( strcasecmp( name, key_name_world_38 ) == 0 )return SDLK_WORLD_38; + else if( strcasecmp( name, key_name_world_39 ) == 0 )return SDLK_WORLD_39; + else if( strcasecmp( name, key_name_world_40 ) == 0 )return SDLK_WORLD_40; + else if( strcasecmp( name, key_name_world_41 ) == 0 )return SDLK_WORLD_41; + else if( strcasecmp( name, key_name_world_42 ) == 0 )return SDLK_WORLD_42; + else if( strcasecmp( name, key_name_world_43 ) == 0 )return SDLK_WORLD_43; + else if( strcasecmp( name, key_name_world_44 ) == 0 )return SDLK_WORLD_44; + else if( strcasecmp( name, key_name_world_45 ) == 0 )return SDLK_WORLD_45; + else if( strcasecmp( name, key_name_world_46 ) == 0 )return SDLK_WORLD_46; + else if( strcasecmp( name, key_name_world_47 ) == 0 )return SDLK_WORLD_47; + else if( strcasecmp( name, key_name_world_48 ) == 0 )return SDLK_WORLD_48; + else if( strcasecmp( name, key_name_world_49 ) == 0 )return SDLK_WORLD_49; + else if( strcasecmp( name, key_name_world_50 ) == 0 )return SDLK_WORLD_50; + else if( strcasecmp( name, key_name_world_51 ) == 0 )return SDLK_WORLD_51; + else if( strcasecmp( name, key_name_world_52 ) == 0 )return SDLK_WORLD_52; + else if( strcasecmp( name, key_name_world_53 ) == 0 )return SDLK_WORLD_53; + else if( strcasecmp( name, key_name_world_54 ) == 0 )return SDLK_WORLD_54; + else if( strcasecmp( name, key_name_world_55 ) == 0 )return SDLK_WORLD_55; + else if( strcasecmp( name, key_name_world_56 ) == 0 )return SDLK_WORLD_56; + else if( strcasecmp( name, key_name_world_57 ) == 0 )return SDLK_WORLD_57; + else if( strcasecmp( name, key_name_world_58 ) == 0 )return SDLK_WORLD_58; + else if( strcasecmp( name, key_name_world_59 ) == 0 )return SDLK_WORLD_59; + else if( strcasecmp( name, key_name_world_60 ) == 0 )return SDLK_WORLD_60; + else if( strcasecmp( name, key_name_world_61 ) == 0 )return SDLK_WORLD_61; + else if( strcasecmp( name, key_name_world_62 ) == 0 )return SDLK_WORLD_62; + else if( strcasecmp( name, key_name_world_63 ) == 0 )return SDLK_WORLD_63; + else if( strcasecmp( name, key_name_world_64 ) == 0 )return SDLK_WORLD_64; + else if( strcasecmp( name, key_name_world_65 ) == 0 )return SDLK_WORLD_65; + else if( strcasecmp( name, key_name_world_66 ) == 0 )return SDLK_WORLD_66; + else if( strcasecmp( name, key_name_world_67 ) == 0 )return SDLK_WORLD_67; + else if( strcasecmp( name, key_name_world_68 ) == 0 )return SDLK_WORLD_68; + else if( strcasecmp( name, key_name_world_69 ) == 0 )return SDLK_WORLD_69; + else if( strcasecmp( name, key_name_world_70 ) == 0 )return SDLK_WORLD_70; + else if( strcasecmp( name, key_name_world_71 ) == 0 )return SDLK_WORLD_71; + else if( strcasecmp( name, key_name_world_72 ) == 0 )return SDLK_WORLD_72; + else if( strcasecmp( name, key_name_world_73 ) == 0 )return SDLK_WORLD_73; + else if( strcasecmp( name, key_name_world_74 ) == 0 )return SDLK_WORLD_74; + else if( strcasecmp( name, key_name_world_75 ) == 0 )return SDLK_WORLD_75; + else if( strcasecmp( name, key_name_world_76 ) == 0 )return SDLK_WORLD_76; + else if( strcasecmp( name, key_name_world_77 ) == 0 )return SDLK_WORLD_77; + else if( strcasecmp( name, key_name_world_78 ) == 0 )return SDLK_WORLD_78; + else if( strcasecmp( name, key_name_world_79 ) == 0 )return SDLK_WORLD_79; + else if( strcasecmp( name, key_name_world_80 ) == 0 )return SDLK_WORLD_80; + else if( strcasecmp( name, key_name_world_81 ) == 0 )return SDLK_WORLD_81; + else if( strcasecmp( name, key_name_world_82 ) == 0 )return SDLK_WORLD_82; + else if( strcasecmp( name, key_name_world_83 ) == 0 )return SDLK_WORLD_83; + else if( strcasecmp( name, key_name_world_84 ) == 0 )return SDLK_WORLD_84; + else if( strcasecmp( name, key_name_world_85 ) == 0 )return SDLK_WORLD_85; + else if( strcasecmp( name, key_name_world_86 ) == 0 )return SDLK_WORLD_86; + else if( strcasecmp( name, key_name_world_87 ) == 0 )return SDLK_WORLD_87; + else if( strcasecmp( name, key_name_world_88 ) == 0 )return SDLK_WORLD_88; + else if( strcasecmp( name, key_name_world_89 ) == 0 )return SDLK_WORLD_89; + else if( strcasecmp( name, key_name_world_90 ) == 0 )return SDLK_WORLD_90; + else if( strcasecmp( name, key_name_world_91 ) == 0 )return SDLK_WORLD_91; + else if( strcasecmp( name, key_name_world_92 ) == 0 )return SDLK_WORLD_92; + else if( strcasecmp( name, key_name_world_93 ) == 0 )return SDLK_WORLD_93; + else if( strcasecmp( name, key_name_world_94 ) == 0 )return SDLK_WORLD_94; + else if( strcasecmp( name, key_name_world_95 ) == 0 )return SDLK_WORLD_95; + else if( strcasecmp( name, key_name_kp0 ) == 0 )return SDLK_KP0; + else if( strcasecmp( name, key_name_kp1 ) == 0 )return SDLK_KP1; + else if( strcasecmp( name, key_name_kp2 ) == 0 )return SDLK_KP2; + else if( strcasecmp( name, key_name_kp3 ) == 0 )return SDLK_KP3; + else if( strcasecmp( name, key_name_kp4 ) == 0 )return SDLK_KP4; + else if( strcasecmp( name, key_name_kp5 ) == 0 )return SDLK_KP5; + else if( strcasecmp( name, key_name_kp6 ) == 0 )return SDLK_KP6; + else if( strcasecmp( name, key_name_kp7 ) == 0 )return SDLK_KP7; + else if( strcasecmp( name, key_name_kp8 ) == 0 )return SDLK_KP8; + else if( strcasecmp( name, key_name_kp9 ) == 0 )return SDLK_KP9; + else if( strcasecmp( name, key_name_kp_period ) == 0 )return SDLK_KP_PERIOD; + else if( strcasecmp( name, key_name_kp_divide ) == 0 )return SDLK_KP_DIVIDE; + else if( strcasecmp( name, key_name_kp_multiply ) == 0 )return SDLK_KP_MULTIPLY; + else if( strcasecmp( name, key_name_kp_minus ) == 0 )return SDLK_KP_MINUS; + else if( strcasecmp( name, key_name_kp_plus ) == 0 )return SDLK_KP_PLUS; + else if( strcasecmp( name, key_name_kp_enter ) == 0 )return SDLK_KP_ENTER; + else if( strcasecmp( name, key_name_kp_equals ) == 0 )return SDLK_KP_EQUALS; + else if( strcasecmp( name, key_name_up ) == 0 )return SDLK_UP; + else if( strcasecmp( name, key_name_down ) == 0 )return SDLK_DOWN; + else if( strcasecmp( name, key_name_right ) == 0 )return SDLK_RIGHT; + else if( strcasecmp( name, key_name_left ) == 0 )return SDLK_LEFT; + else if( strcasecmp( name, key_name_insert ) == 0 )return SDLK_INSERT; + else if( strcasecmp( name, key_name_home ) == 0 )return SDLK_HOME; + else if( strcasecmp( name, key_name_end ) == 0 )return SDLK_END; + else if( strcasecmp( name, key_name_pageup ) == 0 )return SDLK_PAGEUP; + else if( strcasecmp( name, key_name_pagedown ) == 0 )return SDLK_PAGEDOWN; + else if( strcasecmp( name, key_name_f1 ) == 0 )return SDLK_F1; + else if( strcasecmp( name, key_name_f2 ) == 0 )return SDLK_F2; + else if( strcasecmp( name, key_name_f3 ) == 0 )return SDLK_F3; + else if( strcasecmp( name, key_name_f4 ) == 0 )return SDLK_F4; + else if( strcasecmp( name, key_name_f5 ) == 0 )return SDLK_F5; + else if( strcasecmp( name, key_name_f6 ) == 0 )return SDLK_F6; + else if( strcasecmp( name, key_name_f7 ) == 0 )return SDLK_F7; + else if( strcasecmp( name, key_name_f8 ) == 0 )return SDLK_F8; + else if( strcasecmp( name, key_name_f9 ) == 0 )return SDLK_F9; + else if( strcasecmp( name, key_name_f10 ) == 0 )return SDLK_F10; + else if( strcasecmp( name, key_name_f11 ) == 0 )return SDLK_F11; + else if( strcasecmp( name, key_name_f12 ) == 0 )return SDLK_F12; + else if( strcasecmp( name, key_name_f13 ) == 0 )return SDLK_F13; + else if( strcasecmp( name, key_name_f14 ) == 0 )return SDLK_F14; + else if( strcasecmp( name, key_name_f15 ) == 0 )return SDLK_F15; + else if( strcasecmp( name, key_name_numlock ) == 0 )return SDLK_NUMLOCK; + else if( strcasecmp( name, key_name_capslock ) == 0 )return SDLK_CAPSLOCK; + else if( strcasecmp( name, key_name_scrollock ) == 0 )return SDLK_SCROLLOCK; + else if( strcasecmp( name, key_name_rshift ) == 0 )return SDLK_RSHIFT; + else if( strcasecmp( name, key_name_lshift ) == 0 )return SDLK_LSHIFT; + else if( strcasecmp( name, key_name_rctrl ) == 0 )return SDLK_RCTRL; + else if( strcasecmp( name, key_name_lctrl ) == 0 )return SDLK_LCTRL; + else if( strcasecmp( name, key_name_ralt ) == 0 )return SDLK_RALT; + else if( strcasecmp( name, key_name_lalt ) == 0 )return SDLK_LALT; + else if( strcasecmp( name, key_name_rmeta ) == 0 )return SDLK_RMETA; + else if( strcasecmp( name, key_name_lmeta ) == 0 )return SDLK_LMETA; + else if( strcasecmp( name, key_name_lsuper ) == 0 )return SDLK_LSUPER; + else if( strcasecmp( name, key_name_rsuper ) == 0 )return SDLK_RSUPER; + else if( strcasecmp( name, key_name_mode ) == 0 )return SDLK_MODE; + else if( strcasecmp( name, key_name_compose ) == 0 )return SDLK_COMPOSE; + else if( strcasecmp( name, key_name_help ) == 0 )return SDLK_HELP; + else if( strcasecmp( name, key_name_print ) == 0 )return SDLK_PRINT; + else if( strcasecmp( name, key_name_sysreq ) == 0 )return SDLK_SYSREQ; + else if( strcasecmp( name, key_name_break ) == 0 )return SDLK_BREAK; + else if( strcasecmp( name, key_name_menu ) == 0 )return SDLK_MENU; + else if( strcasecmp( name, key_name_power ) == 0 )return SDLK_POWER; + else if( strcasecmp( name, key_name_euro ) == 0 )return SDLK_EURO; + else if( strcasecmp( name, key_name_undo ) == 0 )return SDLK_UNDO; + return 0; +} + +const char *key_name( int key ) { + switch( key ) { + case SDLK_BACKSPACE: return key_name_backspace; + case SDLK_TAB: return key_name_tab; + case SDLK_CLEAR: return key_name_clear; + case SDLK_RETURN: return key_name_return; + case SDLK_PAUSE: return key_name_pause; + case SDLK_ESCAPE: return key_name_escape; + case SDLK_SPACE: return key_name_space; + case SDLK_EXCLAIM: return key_name_exclaim; + case SDLK_QUOTEDBL: return key_name_quotedbl; + case SDLK_HASH: return key_name_hash; + case SDLK_DOLLAR: return key_name_dollar; + case SDLK_AMPERSAND: return key_name_ampersand; + case SDLK_QUOTE: return key_name_quote; + case SDLK_LEFTPAREN: return key_name_leftparen; + case SDLK_RIGHTPAREN: return key_name_rightparen; + case SDLK_ASTERISK: return key_name_asterisk; + case SDLK_PLUS: return key_name_plus; + case SDLK_COMMA: return key_name_comma; + case SDLK_MINUS: return key_name_minus; + case SDLK_PERIOD: return key_name_period; + case SDLK_SLASH: return key_name_slash; + case SDLK_0: return key_name_0; + case SDLK_1: return key_name_1; + case SDLK_2: return key_name_2; + case SDLK_3: return key_name_3; + case SDLK_4: return key_name_4; + case SDLK_5: return key_name_5; + case SDLK_6: return key_name_6; + case SDLK_7: return key_name_7; + case SDLK_8: return key_name_8; + case SDLK_9: return key_name_9; + case SDLK_COLON: return key_name_colon; + case SDLK_SEMICOLON: return key_name_semicolon; + case SDLK_LESS: return key_name_less; + case SDLK_EQUALS: return key_name_equals; + case SDLK_GREATER: return key_name_greater; + case SDLK_QUESTION: return key_name_question; + case SDLK_AT: return key_name_at; + case SDLK_LEFTBRACKET: return key_name_leftbracket; + case SDLK_BACKSLASH: return key_name_backslash; + case SDLK_RIGHTBRACKET: return key_name_rightbracket; + case SDLK_CARET: return key_name_caret; + case SDLK_UNDERSCORE: return key_name_underscore; + case SDLK_BACKQUOTE: return key_name_backquote; + case SDLK_a: return key_name_a; + case SDLK_b: return key_name_b; + case SDLK_c: return key_name_c; + case SDLK_d: return key_name_d; + case SDLK_e: return key_name_e; + case SDLK_f: return key_name_f; + case SDLK_g: return key_name_g; + case SDLK_h: return key_name_h; + case SDLK_i: return key_name_i; + case SDLK_j: return key_name_j; + case SDLK_k: return key_name_k; + case SDLK_l: return key_name_l; + case SDLK_m: return key_name_m; + case SDLK_n: return key_name_n; + case SDLK_o: return key_name_o; + case SDLK_p: return key_name_p; + case SDLK_q: return key_name_q; + case SDLK_r: return key_name_r; + case SDLK_s: return key_name_s; + case SDLK_t: return key_name_t; + case SDLK_u: return key_name_u; + case SDLK_v: return key_name_v; + case SDLK_w: return key_name_w; + case SDLK_x: return key_name_x; + case SDLK_y: return key_name_y; + case SDLK_z: return key_name_z; + case SDLK_DELETE: return key_name_delete; + case SDLK_WORLD_0: return key_name_world_0; + case SDLK_WORLD_1: return key_name_world_1; + case SDLK_WORLD_2: return key_name_world_2; + case SDLK_WORLD_3: return key_name_world_3; + case SDLK_WORLD_4: return key_name_world_4; + case SDLK_WORLD_5: return key_name_world_5; + case SDLK_WORLD_6: return key_name_world_6; + case SDLK_WORLD_7: return key_name_world_7; + case SDLK_WORLD_8: return key_name_world_8; + case SDLK_WORLD_9: return key_name_world_9; + case SDLK_WORLD_10: return key_name_world_10; + case SDLK_WORLD_11: return key_name_world_11; + case SDLK_WORLD_12: return key_name_world_12; + case SDLK_WORLD_13: return key_name_world_13; + case SDLK_WORLD_14: return key_name_world_14; + case SDLK_WORLD_15: return key_name_world_15; + case SDLK_WORLD_16: return key_name_world_16; + case SDLK_WORLD_17: return key_name_world_17; + case SDLK_WORLD_18: return key_name_world_18; + case SDLK_WORLD_19: return key_name_world_19; + case SDLK_WORLD_20: return key_name_world_20; + case SDLK_WORLD_21: return key_name_world_21; + case SDLK_WORLD_22: return key_name_world_22; + case SDLK_WORLD_23: return key_name_world_23; + case SDLK_WORLD_24: return key_name_world_24; + case SDLK_WORLD_25: return key_name_world_25; + case SDLK_WORLD_26: return key_name_world_26; + case SDLK_WORLD_27: return key_name_world_27; + case SDLK_WORLD_28: return key_name_world_28; + case SDLK_WORLD_29: return key_name_world_29; + case SDLK_WORLD_30: return key_name_world_30; + case SDLK_WORLD_31: return key_name_world_31; + case SDLK_WORLD_32: return key_name_world_32; + case SDLK_WORLD_33: return key_name_world_33; + case SDLK_WORLD_34: return key_name_world_34; + case SDLK_WORLD_35: return key_name_world_35; + case SDLK_WORLD_36: return key_name_world_36; + case SDLK_WORLD_37: return key_name_world_37; + case SDLK_WORLD_38: return key_name_world_38; + case SDLK_WORLD_39: return key_name_world_39; + case SDLK_WORLD_40: return key_name_world_40; + case SDLK_WORLD_41: return key_name_world_41; + case SDLK_WORLD_42: return key_name_world_42; + case SDLK_WORLD_43: return key_name_world_43; + case SDLK_WORLD_44: return key_name_world_44; + case SDLK_WORLD_45: return key_name_world_45; + case SDLK_WORLD_46: return key_name_world_46; + case SDLK_WORLD_47: return key_name_world_47; + case SDLK_WORLD_48: return key_name_world_48; + case SDLK_WORLD_49: return key_name_world_49; + case SDLK_WORLD_50: return key_name_world_50; + case SDLK_WORLD_51: return key_name_world_51; + case SDLK_WORLD_52: return key_name_world_52; + case SDLK_WORLD_53: return key_name_world_53; + case SDLK_WORLD_54: return key_name_world_54; + case SDLK_WORLD_55: return key_name_world_55; + case SDLK_WORLD_56: return key_name_world_56; + case SDLK_WORLD_57: return key_name_world_57; + case SDLK_WORLD_58: return key_name_world_58; + case SDLK_WORLD_59: return key_name_world_59; + case SDLK_WORLD_60: return key_name_world_60; + case SDLK_WORLD_61: return key_name_world_61; + case SDLK_WORLD_62: return key_name_world_62; + case SDLK_WORLD_63: return key_name_world_63; + case SDLK_WORLD_64: return key_name_world_64; + case SDLK_WORLD_65: return key_name_world_65; + case SDLK_WORLD_66: return key_name_world_66; + case SDLK_WORLD_67: return key_name_world_67; + case SDLK_WORLD_68: return key_name_world_68; + case SDLK_WORLD_69: return key_name_world_69; + case SDLK_WORLD_70: return key_name_world_70; + case SDLK_WORLD_71: return key_name_world_71; + case SDLK_WORLD_72: return key_name_world_72; + case SDLK_WORLD_73: return key_name_world_73; + case SDLK_WORLD_74: return key_name_world_74; + case SDLK_WORLD_75: return key_name_world_75; + case SDLK_WORLD_76: return key_name_world_76; + case SDLK_WORLD_77: return key_name_world_77; + case SDLK_WORLD_78: return key_name_world_78; + case SDLK_WORLD_79: return key_name_world_79; + case SDLK_WORLD_80: return key_name_world_80; + case SDLK_WORLD_81: return key_name_world_81; + case SDLK_WORLD_82: return key_name_world_82; + case SDLK_WORLD_83: return key_name_world_83; + case SDLK_WORLD_84: return key_name_world_84; + case SDLK_WORLD_85: return key_name_world_85; + case SDLK_WORLD_86: return key_name_world_86; + case SDLK_WORLD_87: return key_name_world_87; + case SDLK_WORLD_88: return key_name_world_88; + case SDLK_WORLD_89: return key_name_world_89; + case SDLK_WORLD_90: return key_name_world_90; + case SDLK_WORLD_91: return key_name_world_91; + case SDLK_WORLD_92: return key_name_world_92; + case SDLK_WORLD_93: return key_name_world_93; + case SDLK_WORLD_94: return key_name_world_94; + case SDLK_WORLD_95: return key_name_world_95; + case SDLK_KP0: return key_name_kp0; + case SDLK_KP1: return key_name_kp1; + case SDLK_KP2: return key_name_kp2; + case SDLK_KP3: return key_name_kp3; + case SDLK_KP4: return key_name_kp4; + case SDLK_KP5: return key_name_kp5; + case SDLK_KP6: return key_name_kp6; + case SDLK_KP7: return key_name_kp7; + case SDLK_KP8: return key_name_kp8; + case SDLK_KP9: return key_name_kp9; + case SDLK_KP_PERIOD: return key_name_kp_period; + case SDLK_KP_DIVIDE: return key_name_kp_divide; + case SDLK_KP_MULTIPLY: return key_name_kp_multiply; + case SDLK_KP_MINUS: return key_name_kp_minus; + case SDLK_KP_PLUS: return key_name_kp_plus; + case SDLK_KP_ENTER: return key_name_kp_enter; + case SDLK_KP_EQUALS: return key_name_kp_equals; + case SDLK_UP: return key_name_up; + case SDLK_DOWN: return key_name_down; + case SDLK_RIGHT: return key_name_right; + case SDLK_LEFT: return key_name_left; + case SDLK_INSERT: return key_name_insert; + case SDLK_HOME: return key_name_home; + case SDLK_END: return key_name_end; + case SDLK_PAGEUP: return key_name_pageup; + case SDLK_PAGEDOWN: return key_name_pagedown; + case SDLK_F1: return key_name_f1; + case SDLK_F2: return key_name_f2; + case SDLK_F3: return key_name_f3; + case SDLK_F4: return key_name_f4; + case SDLK_F5: return key_name_f5; + case SDLK_F6: return key_name_f6; + case SDLK_F7: return key_name_f7; + case SDLK_F8: return key_name_f8; + case SDLK_F9: return key_name_f9; + case SDLK_F10: return key_name_f10; + case SDLK_F11: return key_name_f11; + case SDLK_F12: return key_name_f12; + case SDLK_F13: return key_name_f13; + case SDLK_F14: return key_name_f14; + case SDLK_F15: return key_name_f15; + case SDLK_NUMLOCK: return key_name_numlock; + case SDLK_CAPSLOCK: return key_name_capslock; + case SDLK_SCROLLOCK: return key_name_scrollock; + case SDLK_RSHIFT: return key_name_rshift; + case SDLK_LSHIFT: return key_name_lshift; + case SDLK_RCTRL: return key_name_rctrl; + case SDLK_LCTRL: return key_name_lctrl; + case SDLK_RALT: return key_name_ralt; + case SDLK_LALT: return key_name_lalt; + case SDLK_RMETA: return key_name_rmeta; + case SDLK_LMETA: return key_name_lmeta; + case SDLK_LSUPER: return key_name_lsuper; + case SDLK_RSUPER: return key_name_rsuper; + case SDLK_MODE: return key_name_mode; + case SDLK_COMPOSE: return key_name_compose; + case SDLK_HELP: return key_name_help; + case SDLK_PRINT: return key_name_print; + case SDLK_SYSREQ: return key_name_sysreq; + case SDLK_BREAK: return key_name_break; + case SDLK_MENU: return key_name_menu; + case SDLK_POWER: return key_name_power; + case SDLK_EURO: return key_name_euro; + case SDLK_UNDO: return key_name_undo; + } + return NULL; +} +