Mercurial > vba-linux
view src/gtk/input.h @ 2:3549bbe597ed
adding makefile.am
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:47 -0600 |
parents | f9f4f1b99eed |
children |
line wrap: on
line source
1 // -*- C++ -*-2 // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.3 // Copyright (C) 1999-2003 Forgotten4 // Copyright (C) 2004 Forgotten and the VBA development team6 // This program is free software; you can redistribute it and/or modify7 // it under the terms of the GNU General Public License as published by8 // 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 of13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 // GNU General Public License for more details.15 //16 // You should have received a copy of the GNU General Public License17 // 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 VBA26 {28 enum EKey29 {30 KeyNone,31 // GBA keys32 KeyA,33 KeyB,34 KeySelect,35 KeyStart,36 KeyRight,37 KeyLeft,38 KeyUp,39 KeyDown,40 KeyR,41 KeyL,42 // VBA extension43 KeySpeed,44 KeyCapture45 };47 enum EKeyFlag48 {49 // GBA keys50 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 extension61 KeyFlagSpeed = 1 << 10,62 KeyFlagCapture = 1 << 11,63 };65 class Keymap66 {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 // noncopyable79 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 VBA92 #endif // __VBA_INPUT_H__