src/interface/keyboard.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00018  ******************************************************************************
00019  * Keyboard managment. Use ClanLIB event.
00020  *****************************************************************************/
00021 
00022 #ifndef KEYBOARD_H
00023 #define KEYBOARD_H
00024 //-----------------------------------------------------------------------------
00025 #include <map>
00026 #include <SDL.h>
00027 #include "../include/action.h"
00028 #include "../include/base.h"
00029 //-----------------------------------------------------------------------------
00030 
00031 class Keyboard
00032 {
00033 private:
00034   std::map<int, Action::Action_t> layout;
00035   bool PressedKeys[Action::ACTION_LAST];
00036 
00037   static Keyboard * singleton;
00038 
00039 private:
00040   // Traite une touche relach�e
00041   void HandleKeyPressed (const Action::Action_t &action);
00042   void HandleKeyReleased (const Action::Action_t &action);
00043 
00044 
00045 public:
00046   Keyboard();
00047   typedef enum
00048   {
00049     KEY_PRESSED,
00050     KEY_RELEASED,
00051     KEY_REFRESH
00052   } Key_Event_t ;
00053 
00054   void HandleKeyEvent( const SDL_Event *event) ;
00055   void Reset();
00056 
00057   // On veut bouger la cam�ra au clavier ?
00058   void TestCamera();
00059 
00060   // Refresh des touches du clavier
00061   void Refresh();
00062 
00063   // Associe une touche � une action.
00064   void SetKeyAction(int key, Action::Action_t at);
00065 
00066   // Get the key associated to an action.
00067   int GetKeyAssociatedToAction(Action::Action_t at);
00068 
00069 };
00070 
00071 //-----------------------------------------------------------------------------
00072 #endif

Generated on Mon Jan 1 13:10:58 2007 for Wormux by  doxygen 1.4.7