|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
17 */ |
|
18 |
|
19 #include "sdlkeys.h" |
|
20 |
|
21 #include <QtGlobal> |
|
22 |
|
23 char sdlkeys[1024][2][128] = |
|
24 { |
|
25 // Mouse |
|
26 {"mousel", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Left button")}, |
|
27 {"mousem", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Middle button")}, |
|
28 {"mouser", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Right button")}, |
|
29 {"mousex1", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X1 button ")}, |
|
30 {"mousex2", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X2 button")}, |
|
31 {"wheelup", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel up")}, |
|
32 {"wheeldown", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel down")}, |
|
33 |
|
34 // Keyboard |
|
35 {"backspace", QT_TRANSLATE_NOOP("binds (keys)", "Backspace")}, |
|
36 {"tab", QT_TRANSLATE_NOOP("binds (keys)", "Tab")}, |
|
37 {"clear", QT_TRANSLATE_NOOP("binds (keys)", "Clear")}, |
|
38 {"return", QT_TRANSLATE_NOOP("binds (keys)", "Return")}, |
|
39 {"pause", QT_TRANSLATE_NOOP("binds (keys)", "Pause")}, |
|
40 {"escape", QT_TRANSLATE_NOOP("binds (keys)", "Escape")}, |
|
41 {"space", QT_TRANSLATE_NOOP("binds (keys)", "Space")}, |
|
42 {"'", "'"}, |
|
43 {",", ","}, |
|
44 {"-", "-"}, |
|
45 {".", "."}, |
|
46 {"/", "/"}, |
|
47 {"0", "0"}, |
|
48 {"1", "1"}, |
|
49 {"2", "2"}, |
|
50 {"3", "3"}, |
|
51 {"4", "4"}, |
|
52 {"5", "5"}, |
|
53 {"6", "6"}, |
|
54 {"7", "7"}, |
|
55 {"8", "8"}, |
|
56 {"9", "9"}, |
|
57 {";", ";"}, |
|
58 {"[", "["}, |
|
59 {"\\", "\\"}, |
|
60 {"]", "]"}, |
|
61 {"`", "`"}, |
|
62 {"a", "A"}, |
|
63 {"b", "B"}, |
|
64 {"c", "C"}, |
|
65 {"d", "D"}, |
|
66 {"e", "E"}, |
|
67 {"f", "F"}, |
|
68 {"g", "G"}, |
|
69 {"h", "H"}, |
|
70 {"i", "I"}, |
|
71 {"j", "J"}, |
|
72 {"k", "K"}, |
|
73 {"l", "L"}, |
|
74 {"m", "M"}, |
|
75 {"n", "N"}, |
|
76 {"o", "O"}, |
|
77 {"p", "P"}, |
|
78 {"q", "Q"}, |
|
79 {"r", "R"}, |
|
80 {"s", "S"}, |
|
81 {"t", "T"}, |
|
82 {"u", "U"}, |
|
83 {"v", "V"}, |
|
84 {"w", "W"}, |
|
85 {"x", "X"}, |
|
86 {"y", "Y"}, |
|
87 {"z", "Z"}, |
|
88 {"keypad_0", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 0")}, |
|
89 {"keypad_1", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 1")}, |
|
90 {"keypad_2", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 2")}, |
|
91 {"keypad_3", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 3")}, |
|
92 {"keypad_4", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 4")}, |
|
93 {"keypad_5", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 5")}, |
|
94 {"keypad_6", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 6")}, |
|
95 {"keypad_7", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 7")}, |
|
96 {"keypad_8", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 8")}, |
|
97 {"keypad_9", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 9")}, |
|
98 {"keypad_.", QT_TRANSLATE_NOOP("binds (keys)", "Keypad .")}, |
|
99 {"keypad_/", QT_TRANSLATE_NOOP("binds (keys)", "Keypad /")}, |
|
100 {"keypad_*", QT_TRANSLATE_NOOP("binds (keys)", "Keypad *")}, |
|
101 {"keypad_-", QT_TRANSLATE_NOOP("binds (keys)", "Keypad -")}, |
|
102 {"keypad_+", QT_TRANSLATE_NOOP("binds (keys)", "Keypad +")}, |
|
103 {"keypad_enter", QT_TRANSLATE_NOOP("binds (keys)", "Keypad Enter")}, |
|
104 {"up", QT_TRANSLATE_NOOP("binds (keys)", "Up")}, |
|
105 {"down", QT_TRANSLATE_NOOP("binds (keys)", "Down")}, |
|
106 {"right", QT_TRANSLATE_NOOP("binds (keys)", "Right")}, |
|
107 {"left", QT_TRANSLATE_NOOP("binds (keys)", "Left")}, |
|
108 {"insert", QT_TRANSLATE_NOOP("binds (keys)", "Insert")}, |
|
109 {"delete", QT_TRANSLATE_NOOP("binds (keys)", "Delete")}, |
|
110 {"home", QT_TRANSLATE_NOOP("binds (keys)", "Home")}, |
|
111 {"end", QT_TRANSLATE_NOOP("binds (keys)", "End")}, |
|
112 {"pageup", QT_TRANSLATE_NOOP("binds (keys)", "PageUp")}, |
|
113 {"pagedown", QT_TRANSLATE_NOOP("binds (keys)", "PageDown")}, |
|
114 {"f1", "F1"}, |
|
115 {"f2", "F2"}, |
|
116 {"f3", "F3"}, |
|
117 {"f4", "F4"}, |
|
118 {"f5", "F5"}, |
|
119 {"f6", "F6"}, |
|
120 {"f7", "F7"}, |
|
121 {"f8", "F8"}, |
|
122 {"f9", "F9"}, |
|
123 {"f10", "F10"}, |
|
124 {"f11", "F11"}, |
|
125 {"f12", "F12"}, |
|
126 {"f13", "F13"}, |
|
127 {"f14", "F14"}, |
|
128 {"f15", "F15"}, |
|
129 {"numlock", QT_TRANSLATE_NOOP("binds (keys)", "Numlock")}, |
|
130 {"capslock", QT_TRANSLATE_NOOP("binds (keys)", "CapsLock")}, |
|
131 {"scrolllock", QT_TRANSLATE_NOOP("binds (keys)", "ScrollLock")}, |
|
132 {"menu", QT_TRANSLATE_NOOP("binds (keys)", "Menu")}, |
|
133 {"right_shift", QT_TRANSLATE_NOOP("binds (keys)", "Right Shift")}, |
|
134 {"left_shift", QT_TRANSLATE_NOOP("binds (keys)", "Left Shift")}, |
|
135 {"right_ctrl", QT_TRANSLATE_NOOP("binds (keys)", "Right Ctrl")}, |
|
136 {"left_ctrl", QT_TRANSLATE_NOOP("binds (keys)", "Left Ctrl")}, |
|
137 {"right_alt", QT_TRANSLATE_NOOP("binds (keys)", "Right Alt")}, |
|
138 {"left_alt", QT_TRANSLATE_NOOP("binds (keys)", "Left Alt")}, |
|
139 //: Windows key / Command key / Meta key /Super key (right) |
|
140 {"right_gui", QT_TRANSLATE_NOOP("binds (keys)", "Right GUI")}, |
|
141 //: Windows key / Command key / Meta key /Super key (left) |
|
142 {"left_gui", QT_TRANSLATE_NOOP("binds (keys)", "Left GUI")} |
|
143 }; |
|
144 |
|
145 // helper list for sdlkeys. true for keyboard keys, false for other |
|
146 bool sdlkeys_iskeyboard[1024]; |
|
147 |
|
148 // button name definitions for Microsoft's XBox360 controller |
|
149 // don't modify button order! |
|
150 char xb360buttons[10][128] = |
|
151 { |
|
152 QT_TRANSLATE_NOOP("binds (keys)", "A button"), |
|
153 QT_TRANSLATE_NOOP("binds (keys)", "B button"), |
|
154 QT_TRANSLATE_NOOP("binds (keys)", "X button"), |
|
155 QT_TRANSLATE_NOOP("binds (keys)", "Y button"), |
|
156 QT_TRANSLATE_NOOP("binds (keys)", "LB button"), |
|
157 QT_TRANSLATE_NOOP("binds (keys)", "RB button"), |
|
158 QT_TRANSLATE_NOOP("binds (keys)", "Back button"), |
|
159 QT_TRANSLATE_NOOP("binds (keys)", "Start button"), |
|
160 QT_TRANSLATE_NOOP("binds (keys)", "Left stick"), |
|
161 QT_TRANSLATE_NOOP("binds (keys)", "Right stick") |
|
162 }; |
|
163 |
|
164 // axis name definitions for Microsoft's XBox360 controller |
|
165 // don't modify axis order! |
|
166 char xbox360axes[][128] = |
|
167 { |
|
168 QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Right)"), |
|
169 QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Left)"), |
|
170 QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Down)"), |
|
171 QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Up)"), |
|
172 QT_TRANSLATE_NOOP("binds (keys)", "Left trigger"), |
|
173 QT_TRANSLATE_NOOP("binds (keys)", "Right trigger"), |
|
174 QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Down)"), |
|
175 QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Up)"), |
|
176 QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Right)"), |
|
177 QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Left)"), |
|
178 }; |
|
179 char xb360dpad[128] = QT_TRANSLATE_NOOP("binds (keys)", "D-pad"); |
|
180 |
|
181 // Generic controller binding names |
|
182 //: Game controller axis direction. %1 = axis number, %2 = direction |
|
183 char controlleraxis[128] = QT_TRANSLATE_NOOP("binds (keys)", "Axis %1 %2"); |
|
184 //: Game controller button. %1 = button number |
|
185 char controllerbutton[128] = QT_TRANSLATE_NOOP("binds (keys)", "Button %1"); |
|
186 //: Game controller D-pad button. %1 = D-pad number, %2 = direction |
|
187 char controllerhat[128] = QT_TRANSLATE_NOOP("binds (keys)", "D-pad %1 %2"); |
|
188 char controllerup[128] = QT_TRANSLATE_NOOP("binds (keys)", "Up"); |
|
189 char controllerdown[128] = QT_TRANSLATE_NOOP("binds (keys)", "Down"); |
|
190 char controllerleft[128] = QT_TRANSLATE_NOOP("binds (keys)", "Left"); |
|
191 char controllerright[128] = QT_TRANSLATE_NOOP("binds (keys)", "Right"); |
|
192 |
|
193 //: Special entry in key selection when an action has no control assigned |
|
194 char unboundcontrol[128] = QT_TRANSLATE_NOOP("binds (keys)", "(Don't use)"); |
|
195 |