2 * Copyright (C) 2008 Jānis Rūcis
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
15 #include <SDL_keyboard.h>
21 /*---------------------------------------------------------------------------*/
23 /* Initial template generated from $SDL/src/events/SDL_keyboard.c */
25 static const char *table[][2] = {
28 * This is a mostly-complete list of human-readable SDL key names. There
29 * might not be corresponding names for all these keys in your language,
30 * and that's perfectly fine -- in such cases just copy the source string.
32 { "backspace", N_("Backspace") },
34 { "clear", N_("Clear") },
35 { "return", N_("Return") },
36 { "pause", N_("Pause") },
37 { "escape", N_("Escape") },
38 { "space", N_("Space") },
39 { "delete", N_("Delete") },
40 { "enter", N_("Enter") },
41 { "equals", N_("Equals") },
43 { "down", N_("Down") },
44 { "right", N_("Right") },
45 { "left", N_("Left") },
46 { "down", N_("Down") },
47 { "insert", N_("Insert") },
48 { "home", N_("Home") },
50 { "page up", N_("Page Up") },
51 { "page down", N_("Page Down") },
67 { "numlock", N_("Num Lock") },
68 { "caps lock", N_("Caps Lock") },
69 { "scroll lock", N_("Scroll Lock") },
70 { "right shift", N_("Right Shift") },
71 { "left shift", N_("Left Shift") },
72 { "right ctrl", N_("Right CTRL") },
73 { "left ctrl", N_("Left CTRL") },
74 { "right alt", N_("Right Alt") },
75 { "left alt", N_("Left Alt") },
76 { "right meta", N_("Right Meta") },
77 { "left meta", N_("Left Meta") },
78 { "left super", N_("Left Super") },
79 { "right super", N_("Right Super") },
80 { "alt gr", N_("Alt Gr") },
81 { "compose", N_("Compose") },
82 { "help", N_("Help") },
83 { "print screen", N_("Print Screen") },
84 { "sys req", N_("Sys Req") },
85 { "break", N_("Break") },
86 { "menu", N_("Menu") },
87 { "power", N_("Power") },
88 { "euro", N_("Euro") },
89 { "undo", N_("Undo") },
92 /*---------------------------------------------------------------------------*/
94 const char *pretty_keyname(SDLKey key)
96 const char *ugly_keyname;
99 if ((ugly_keyname = SDL_GetKeyName(key)) == NULL)
102 for (i = 0; i < ARRAYSIZE(table); i++)
103 if (strcmp(table[i][0], ugly_keyname) == 0)
104 return _(table[i][1]);
109 /*---------------------------------------------------------------------------*/