diff src/gtk/input.cpp @ 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.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,53 @@
     1.4 +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
     1.5 +// Copyright (C) 1999-2003 Forgotten
     1.6 +// Copyright (C) 2004 Forgotten and the VBA development team
     1.7 +
     1.8 +// This program is free software; you can redistribute it and/or modify
     1.9 +// it under the terms of the GNU General Public License as published by
    1.10 +// the Free Software Foundation; either version 2, or(at your option)
    1.11 +// any later version.
    1.12 +//
    1.13 +// This program is distributed in the hope that it will be useful,
    1.14 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +// GNU General Public License for more details.
    1.17 +//
    1.18 +// You should have received a copy of the GNU General Public License
    1.19 +// along with this program; if not, write to the Free Software Foundation,
    1.20 +// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1.21 +
    1.22 +#include "input.h"
    1.23 +
    1.24 +#include <new>
    1.25 +
    1.26 +namespace VBA
    1.27 +{
    1.28 +
    1.29 +Keymap::Keymap()
    1.30 +{
    1.31 +  m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal);
    1.32 +  if (m_pstTable == NULL)
    1.33 +  {
    1.34 +    throw std::bad_alloc();
    1.35 +  }
    1.36 +}
    1.37 +
    1.38 +Keymap::~Keymap()
    1.39 +{
    1.40 +  g_hash_table_destroy(m_pstTable);
    1.41 +}
    1.42 +
    1.43 +void Keymap::vRegister(guint _uiVal, EKey _eKey)
    1.44 +{
    1.45 +  g_hash_table_insert(m_pstTable,
    1.46 +                      GUINT_TO_POINTER(_uiVal),
    1.47 +                      GUINT_TO_POINTER(_eKey));
    1.48 +}
    1.49 +
    1.50 +void Keymap::vClear()
    1.51 +{
    1.52 +  g_hash_table_destroy(m_pstTable);
    1.53 +  m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal);
    1.54 +}
    1.55 +
    1.56 +} // namespace VBA