Mercurial > vba-linux
diff src/gtk/input.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/gtk/input.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,92 @@ 1.4 +// -*- C++ -*- 1.5 +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. 1.6 +// Copyright (C) 1999-2003 Forgotten 1.7 +// Copyright (C) 2004 Forgotten and the VBA development team 1.8 + 1.9 +// This program is free software; you can redistribute it and/or modify 1.10 +// it under the terms of the GNU General Public License as published by 1.11 +// the Free Software Foundation; either version 2, or(at your option) 1.12 +// any later version. 1.13 +// 1.14 +// This program is distributed in the hope that it will be useful, 1.15 +// but WITHOUT ANY WARRANTY; without even the implied warranty of 1.16 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.17 +// GNU General Public License for more details. 1.18 +// 1.19 +// You should have received a copy of the GNU General Public License 1.20 +// along with this program; if not, write to the Free Software Foundation, 1.21 +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1.22 + 1.23 +#ifndef __VBA_INPUT_H__ 1.24 +#define __VBA_INPUT_H__ 1.25 + 1.26 +#include <glib.h> 1.27 + 1.28 +namespace VBA 1.29 +{ 1.30 + 1.31 +enum EKey 1.32 +{ 1.33 + KeyNone, 1.34 + // GBA keys 1.35 + KeyA, 1.36 + KeyB, 1.37 + KeySelect, 1.38 + KeyStart, 1.39 + KeyRight, 1.40 + KeyLeft, 1.41 + KeyUp, 1.42 + KeyDown, 1.43 + KeyR, 1.44 + KeyL, 1.45 + // VBA extension 1.46 + KeySpeed, 1.47 + KeyCapture 1.48 +}; 1.49 + 1.50 +enum EKeyFlag 1.51 +{ 1.52 + // GBA keys 1.53 + KeyFlagA = 1 << 0, 1.54 + KeyFlagB = 1 << 1, 1.55 + KeyFlagSelect = 1 << 2, 1.56 + KeyFlagStart = 1 << 3, 1.57 + KeyFlagRight = 1 << 4, 1.58 + KeyFlagLeft = 1 << 5, 1.59 + KeyFlagUp = 1 << 6, 1.60 + KeyFlagDown = 1 << 7, 1.61 + KeyFlagR = 1 << 8, 1.62 + KeyFlagL = 1 << 9, 1.63 + // VBA extension 1.64 + KeyFlagSpeed = 1 << 10, 1.65 + KeyFlagCapture = 1 << 11, 1.66 +}; 1.67 + 1.68 +class Keymap 1.69 +{ 1.70 + public: 1.71 + Keymap(); 1.72 + ~Keymap(); 1.73 + 1.74 + void vRegister(guint _uiVal, EKey _eKey); 1.75 + void vClear(); 1.76 + inline EKey eGetKey(guint _uiVal); 1.77 + 1.78 + private: 1.79 + GHashTable * m_pstTable; 1.80 + 1.81 + // noncopyable 1.82 + Keymap(const Keymap &); 1.83 + Keymap & operator=(const Keymap &); 1.84 +}; 1.85 + 1.86 +inline EKey Keymap::eGetKey(guint _uiVal) 1.87 +{ 1.88 + return (EKey)GPOINTER_TO_UINT(g_hash_table_lookup(m_pstTable, 1.89 + GUINT_TO_POINTER(_uiVal))); 1.90 +} 1.91 + 1.92 +} // namespace VBA 1.93 + 1.94 + 1.95 +#endif // __VBA_INPUT_H__