tagging release
[dasher.git] / trunk / Src / Win32 / KeyboardHelper.cpp
blobfb0adf54c216c7b1ceb38b560a71c00b8b3b592a
1 #include "Common\WinCommon.h"
2 #include "KeyboardHelper.h"
4 // TODO: This is essentially the same as the GTK code - should probably share them a little more
6 CKeyboardHelper::CKeyboardHelper() {
7 // TODO: Hard code the mappings for now, but eventually make these
8 // configurable (at which point we shouldn't need to know about the
9 // GDK constants.
11 // 1 = E
12 // 2 = N
13 // 3 = W
14 // 4 = S
16 // Left of keyboard
18 m_mTable[0x41] = 1; //a
19 m_mTable[0x53] = 3; // s
20 m_mTable[0x57] = 2;// w
21 m_mTable[0x5a] = 4;// z
23 // Right of keyboard
25 m_mTable[0x4a] = 1; // j
26 m_mTable[0x4b] = 3; // k
27 m_mTable[0x49] = 2; // i
28 m_mTable[0x4d] = 4; // m
30 // Arrows
32 m_mTable[VK_LEFT] = 1;
33 m_mTable[VK_RIGHT] = 3;
34 m_mTable[VK_UP] = 2;
35 m_mTable[VK_DOWN] = 4;
37 // Arrows on numeric keypad
39 m_mTable[VK_NUMPAD4] = 1;
40 m_mTable[VK_NUMPAD6] = 3;
41 m_mTable[VK_NUMPAD8] = 2;
42 m_mTable[VK_NUMPAD2] = 4;
44 // Numbers
46 m_mTable[0x31] = 1; // 11
47 m_mTable[0x32] = 2; // 2
48 m_mTable[0x33] = 3; // 3
49 m_mTable[0x34] = 4; // 4
51 // 0 = keyboard start/stop
53 m_mTable[VK_SPACE] = 0;
56 int CKeyboardHelper::ConvertKeyCode(int iCode) {
57 std::map<int, int>::iterator it(m_mTable.find(iCode));
59 if(it == m_mTable.end())
60 return -1;
61 else
62 return it->second;