view src/gtk/input.h @ 7:c0a590a394c3

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