rlm@1: // -*- C++ -*- rlm@1: // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. rlm@1: // Copyright (C) 1999-2003 Forgotten rlm@1: // Copyright (C) 2004 Forgotten and the VBA development team rlm@1: rlm@1: // This program is free software; you can redistribute it and/or modify rlm@1: // it under the terms of the GNU General Public License as published by rlm@1: // the Free Software Foundation; either version 2, or(at your option) rlm@1: // any later version. rlm@1: // rlm@1: // This program is distributed in the hope that it will be useful, rlm@1: // but WITHOUT ANY WARRANTY; without even the implied warranty of rlm@1: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rlm@1: // GNU General Public License for more details. rlm@1: // rlm@1: // You should have received a copy of the GNU General Public License rlm@1: // along with this program; if not, write to the Free Software Foundation, rlm@1: // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. rlm@1: rlm@1: #ifndef __VBA_INPUT_H__ rlm@1: #define __VBA_INPUT_H__ rlm@1: rlm@1: #include rlm@1: rlm@1: namespace VBA rlm@1: { rlm@1: rlm@1: enum EKey rlm@1: { rlm@1: KeyNone, rlm@1: // GBA keys rlm@1: KeyA, rlm@1: KeyB, rlm@1: KeySelect, rlm@1: KeyStart, rlm@1: KeyRight, rlm@1: KeyLeft, rlm@1: KeyUp, rlm@1: KeyDown, rlm@1: KeyR, rlm@1: KeyL, rlm@1: // VBA extension rlm@1: KeySpeed, rlm@1: KeyCapture rlm@1: }; rlm@1: rlm@1: enum EKeyFlag rlm@1: { rlm@1: // GBA keys rlm@1: KeyFlagA = 1 << 0, rlm@1: KeyFlagB = 1 << 1, rlm@1: KeyFlagSelect = 1 << 2, rlm@1: KeyFlagStart = 1 << 3, rlm@1: KeyFlagRight = 1 << 4, rlm@1: KeyFlagLeft = 1 << 5, rlm@1: KeyFlagUp = 1 << 6, rlm@1: KeyFlagDown = 1 << 7, rlm@1: KeyFlagR = 1 << 8, rlm@1: KeyFlagL = 1 << 9, rlm@1: // VBA extension rlm@1: KeyFlagSpeed = 1 << 10, rlm@1: KeyFlagCapture = 1 << 11, rlm@1: }; rlm@1: rlm@1: class Keymap rlm@1: { rlm@1: public: rlm@1: Keymap(); rlm@1: ~Keymap(); rlm@1: rlm@1: void vRegister(guint _uiVal, EKey _eKey); rlm@1: void vClear(); rlm@1: inline EKey eGetKey(guint _uiVal); rlm@1: rlm@1: private: rlm@1: GHashTable * m_pstTable; rlm@1: rlm@1: // noncopyable rlm@1: Keymap(const Keymap &); rlm@1: Keymap & operator=(const Keymap &); rlm@1: }; rlm@1: rlm@1: inline EKey Keymap::eGetKey(guint _uiVal) rlm@1: { rlm@1: return (EKey)GPOINTER_TO_UINT(g_hash_table_lookup(m_pstTable, rlm@1: GUINT_TO_POINTER(_uiVal))); rlm@1: } rlm@1: rlm@1: } // namespace VBA rlm@1: rlm@1: rlm@1: #endif // __VBA_INPUT_H__