File: sdlkeys.cpp

package info (click to toggle)
hedgewars 1.0.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 218,948 kB
  • sloc: pascal: 54,829; cpp: 27,221; ansic: 22,649; java: 8,210; haskell: 6,788; xml: 3,076; sh: 580; objc: 113; python: 105; makefile: 33
file content (195 lines) | stat: -rw-r--r-- 7,808 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*
 * Hedgewars, a free turn based strategy game
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "sdlkeys.h"

#include <QtGlobal>

char sdlkeys[1024][2][128] =
{
    // Mouse
    {"mousel", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Left button")},
    {"mousem", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Middle button")},
    {"mouser", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Right button")},
    {"mousex1", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X1 button ")},
    {"mousex2", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: X2 button")},
    {"wheelup", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel up")},
    {"wheeldown", QT_TRANSLATE_NOOP("binds (keys)", "Mouse: Wheel down")},

    // Keyboard
    {"backspace", QT_TRANSLATE_NOOP("binds (keys)", "Backspace")},
    {"tab", QT_TRANSLATE_NOOP("binds (keys)", "Tab")},
    {"clear", QT_TRANSLATE_NOOP("binds (keys)", "Clear")},
    {"return", QT_TRANSLATE_NOOP("binds (keys)", "Return")},
    {"pause", QT_TRANSLATE_NOOP("binds (keys)", "Pause")},
    {"escape", QT_TRANSLATE_NOOP("binds (keys)", "Escape")},
    {"space", QT_TRANSLATE_NOOP("binds (keys)", "Space")},
    {"'", "'"},
    {",", ","},
    {"-", "-"},
    {".", "."},
    {"/", "/"},
    {"0", "0"},
    {"1", "1"},
    {"2", "2"},
    {"3", "3"},
    {"4", "4"},
    {"5", "5"},
    {"6", "6"},
    {"7", "7"},
    {"8", "8"},
    {"9", "9"},
    {";", ";"},
    {"[", "["},
    {"\\", "\\"},
    {"]", "]"},
    {"`", "`"},
    {"a", "A"},
    {"b", "B"},
    {"c", "C"},
    {"d", "D"},
    {"e", "E"},
    {"f", "F"},
    {"g", "G"},
    {"h", "H"},
    {"i", "I"},
    {"j", "J"},
    {"k", "K"},
    {"l", "L"},
    {"m", "M"},
    {"n", "N"},
    {"o", "O"},
    {"p", "P"},
    {"q", "Q"},
    {"r", "R"},
    {"s", "S"},
    {"t", "T"},
    {"u", "U"},
    {"v", "V"},
    {"w", "W"},
    {"x", "X"},
    {"y", "Y"},
    {"z", "Z"},
    {"keypad_0", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 0")},
    {"keypad_1", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 1")},
    {"keypad_2", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 2")},
    {"keypad_3", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 3")},
    {"keypad_4", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 4")},
    {"keypad_5", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 5")},
    {"keypad_6", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 6")},
    {"keypad_7", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 7")},
    {"keypad_8", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 8")},
    {"keypad_9", QT_TRANSLATE_NOOP("binds (keys)", "Keypad 9")},
    {"keypad_.", QT_TRANSLATE_NOOP("binds (keys)", "Keypad .")},
    {"keypad_/", QT_TRANSLATE_NOOP("binds (keys)", "Keypad /")},
    {"keypad_*", QT_TRANSLATE_NOOP("binds (keys)", "Keypad *")},
    {"keypad_-", QT_TRANSLATE_NOOP("binds (keys)", "Keypad -")},
    {"keypad_+", QT_TRANSLATE_NOOP("binds (keys)", "Keypad +")},
    {"keypad_enter", QT_TRANSLATE_NOOP("binds (keys)", "Keypad Enter")},
    {"up", QT_TRANSLATE_NOOP("binds (keys)", "Up")},
    {"down", QT_TRANSLATE_NOOP("binds (keys)", "Down")},
    {"right", QT_TRANSLATE_NOOP("binds (keys)", "Right")},
    {"left", QT_TRANSLATE_NOOP("binds (keys)", "Left")},
    {"insert", QT_TRANSLATE_NOOP("binds (keys)", "Insert")},
    {"delete", QT_TRANSLATE_NOOP("binds (keys)", "Delete")},
    {"home", QT_TRANSLATE_NOOP("binds (keys)", "Home")},
    {"end", QT_TRANSLATE_NOOP("binds (keys)", "End")},
    {"pageup", QT_TRANSLATE_NOOP("binds (keys)", "PageUp")},
    {"pagedown", QT_TRANSLATE_NOOP("binds (keys)", "PageDown")},
    {"f1", "F1"},
    {"f2", "F2"},
    {"f3", "F3"},
    {"f4", "F4"},
    {"f5", "F5"},
    {"f6", "F6"},
    {"f7", "F7"},
    {"f8", "F8"},
    {"f9", "F9"},
    {"f10", "F10"},
    {"f11", "F11"},
    {"f12", "F12"},
    {"f13", "F13"},
    {"f14", "F14"},
    {"f15", "F15"},
    {"numlock", QT_TRANSLATE_NOOP("binds (keys)", "Numlock")},
    {"capslock", QT_TRANSLATE_NOOP("binds (keys)", "CapsLock")},
    {"scrolllock", QT_TRANSLATE_NOOP("binds (keys)", "ScrollLock")},
    {"menu", QT_TRANSLATE_NOOP("binds (keys)", "Menu")},
    {"right_shift", QT_TRANSLATE_NOOP("binds (keys)", "Right Shift")},
    {"left_shift", QT_TRANSLATE_NOOP("binds (keys)", "Left Shift")},
    {"right_ctrl", QT_TRANSLATE_NOOP("binds (keys)", "Right Ctrl")},
    {"left_ctrl", QT_TRANSLATE_NOOP("binds (keys)", "Left Ctrl")},
    {"right_alt", QT_TRANSLATE_NOOP("binds (keys)", "Right Alt")},
    {"left_alt", QT_TRANSLATE_NOOP("binds (keys)", "Left Alt")},
    //: Windows key / Command key / Meta key /Super key (right)
    {"right_gui", QT_TRANSLATE_NOOP("binds (keys)", "Right GUI")},
    //: Windows key / Command key / Meta key /Super key (left)
    {"left_gui", QT_TRANSLATE_NOOP("binds (keys)", "Left GUI")}
};

// helper list for sdlkeys. true for keyboard keys, false for other
bool sdlkeys_iskeyboard[1024];

// button name definitions for Microsoft's XBox360 controller
// don't modify button order!
char xb360buttons[10][128] =
{
    QT_TRANSLATE_NOOP("binds (keys)", "A button"),
    QT_TRANSLATE_NOOP("binds (keys)", "B button"),
    QT_TRANSLATE_NOOP("binds (keys)", "X button"),
    QT_TRANSLATE_NOOP("binds (keys)", "Y button"),
    QT_TRANSLATE_NOOP("binds (keys)", "LB button"),
    QT_TRANSLATE_NOOP("binds (keys)", "RB button"),
    QT_TRANSLATE_NOOP("binds (keys)", "Back button"),
    QT_TRANSLATE_NOOP("binds (keys)", "Start button"),
    QT_TRANSLATE_NOOP("binds (keys)", "Left stick"),
    QT_TRANSLATE_NOOP("binds (keys)", "Right stick")
};

// axis name definitions for Microsoft's XBox360 controller
// don't modify axis order!
char xbox360axes[][128] =
{
    QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Right)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Left)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Down)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Left stick (Up)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Left trigger"),
    QT_TRANSLATE_NOOP("binds (keys)", "Right trigger"),
    QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Down)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Up)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Right)"),
    QT_TRANSLATE_NOOP("binds (keys)", "Right stick (Left)"),
};
char xb360dpad[128] = QT_TRANSLATE_NOOP("binds (keys)", "D-pad");

// Generic controller binding names
//: Game controller axis direction. %1 = axis number, %2 = direction
char controlleraxis[128] = QT_TRANSLATE_NOOP("binds (keys)", "Axis %1 %2");
//: Game controller button. %1 = button number
char controllerbutton[128] = QT_TRANSLATE_NOOP("binds (keys)", "Button %1");
//: Game controller D-pad button. %1 = D-pad number, %2 = direction
char controllerhat[128] = QT_TRANSLATE_NOOP("binds (keys)", "D-pad %1 %2");
char controllerup[128] = QT_TRANSLATE_NOOP("binds (keys)", "Up");
char controllerdown[128] = QT_TRANSLATE_NOOP("binds (keys)", "Down");
char controllerleft[128] = QT_TRANSLATE_NOOP("binds (keys)", "Left");
char controllerright[128] = QT_TRANSLATE_NOOP("binds (keys)", "Right");

//: Special entry in key selection when an action has no control assigned
char unboundcontrol[128] = QT_TRANSLATE_NOOP("binds (keys)", "(Don't use)");