rlm@1
|
1 // -*- C++ -*-
|
rlm@1
|
2 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
rlm@1
|
3 // Copyright (C) 1999-2003 Forgotten
|
rlm@1
|
4 // Copyright (C) 2004 Forgotten and the VBA development team
|
rlm@1
|
5
|
rlm@1
|
6 // This program is free software; you can redistribute it and/or modify
|
rlm@1
|
7 // it under the terms of the GNU General Public License as published by
|
rlm@1
|
8 // the Free Software Foundation; either version 2, or(at your option)
|
rlm@1
|
9 // any later version.
|
rlm@1
|
10 //
|
rlm@1
|
11 // This program is distributed in the hope that it will be useful,
|
rlm@1
|
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
rlm@1
|
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
rlm@1
|
14 // GNU General Public License for more details.
|
rlm@1
|
15 //
|
rlm@1
|
16 // You should have received a copy of the GNU General Public License
|
rlm@1
|
17 // along with this program; if not, write to the Free Software Foundation,
|
rlm@1
|
18 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
rlm@1
|
19
|
rlm@1
|
20 #ifndef __VBA_INPUT_H__
|
rlm@1
|
21 #define __VBA_INPUT_H__
|
rlm@1
|
22
|
rlm@1
|
23 #include <glib.h>
|
rlm@1
|
24
|
rlm@1
|
25 namespace VBA
|
rlm@1
|
26 {
|
rlm@1
|
27
|
rlm@1
|
28 enum EKey
|
rlm@1
|
29 {
|
rlm@1
|
30 KeyNone,
|
rlm@1
|
31 // GBA keys
|
rlm@1
|
32 KeyA,
|
rlm@1
|
33 KeyB,
|
rlm@1
|
34 KeySelect,
|
rlm@1
|
35 KeyStart,
|
rlm@1
|
36 KeyRight,
|
rlm@1
|
37 KeyLeft,
|
rlm@1
|
38 KeyUp,
|
rlm@1
|
39 KeyDown,
|
rlm@1
|
40 KeyR,
|
rlm@1
|
41 KeyL,
|
rlm@1
|
42 // VBA extension
|
rlm@1
|
43 KeySpeed,
|
rlm@1
|
44 KeyCapture
|
rlm@1
|
45 };
|
rlm@1
|
46
|
rlm@1
|
47 enum EKeyFlag
|
rlm@1
|
48 {
|
rlm@1
|
49 // GBA keys
|
rlm@1
|
50 KeyFlagA = 1 << 0,
|
rlm@1
|
51 KeyFlagB = 1 << 1,
|
rlm@1
|
52 KeyFlagSelect = 1 << 2,
|
rlm@1
|
53 KeyFlagStart = 1 << 3,
|
rlm@1
|
54 KeyFlagRight = 1 << 4,
|
rlm@1
|
55 KeyFlagLeft = 1 << 5,
|
rlm@1
|
56 KeyFlagUp = 1 << 6,
|
rlm@1
|
57 KeyFlagDown = 1 << 7,
|
rlm@1
|
58 KeyFlagR = 1 << 8,
|
rlm@1
|
59 KeyFlagL = 1 << 9,
|
rlm@1
|
60 // VBA extension
|
rlm@1
|
61 KeyFlagSpeed = 1 << 10,
|
rlm@1
|
62 KeyFlagCapture = 1 << 11,
|
rlm@1
|
63 };
|
rlm@1
|
64
|
rlm@1
|
65 class Keymap
|
rlm@1
|
66 {
|
rlm@1
|
67 public:
|
rlm@1
|
68 Keymap();
|
rlm@1
|
69 ~Keymap();
|
rlm@1
|
70
|
rlm@1
|
71 void vRegister(guint _uiVal, EKey _eKey);
|
rlm@1
|
72 void vClear();
|
rlm@1
|
73 inline EKey eGetKey(guint _uiVal);
|
rlm@1
|
74
|
rlm@1
|
75 private:
|
rlm@1
|
76 GHashTable * m_pstTable;
|
rlm@1
|
77
|
rlm@1
|
78 // noncopyable
|
rlm@1
|
79 Keymap(const Keymap &);
|
rlm@1
|
80 Keymap & operator=(const Keymap &);
|
rlm@1
|
81 };
|
rlm@1
|
82
|
rlm@1
|
83 inline EKey Keymap::eGetKey(guint _uiVal)
|
rlm@1
|
84 {
|
rlm@1
|
85 return (EKey)GPOINTER_TO_UINT(g_hash_table_lookup(m_pstTable,
|
rlm@1
|
86 GUINT_TO_POINTER(_uiVal)));
|
rlm@1
|
87 }
|
rlm@1
|
88
|
rlm@1
|
89 } // namespace VBA
|
rlm@1
|
90
|
rlm@1
|
91
|
rlm@1
|
92 #endif // __VBA_INPUT_H__
|