stechec/sdl/Input.hh

00001 /*
00002 ** TowBowlTactics, an adaptation of the tabletop game Blood Bowl.
00003 **
00004 ** Copyright (C) 2006 The TBT Team.
00005 **
00006 ** This program is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU General Public License
00008 ** as published by the Free Software Foundation; either version 2
00009 ** of the License, or (at your option) any later version.
00010 **
00011 ** The complete GNU General Public Licence Notice can be found as the
00012 ** `NOTICE' file in the root directory.
00013 **
00014 ** The TBT Team consists of people listed in the `AUTHORS' file.
00015 */
00016 
00017 #ifndef INPUT_HH_
00018 # define INPUT_HH_
00019 
00020 # include <SDL.h>
00021 # include "tools.hh"
00022 
00040 class Input
00041 {
00042 public:
00043   Input();
00044   ~Input();
00045 
00046   static Input* getInst();
00047 
00049   void reset();
00050   
00052   void update(SDL_Event& event);
00053 
00056   bool isModDown(int mod) const;
00058   bool isModPressed(int mod) const;
00059 
00063   bool lockKeyboard(const std::string& lock_id);
00066   bool unlockKeyboard(const std::string& lock_id);
00068   bool isKeyboardLocked() const;
00069 
00070   const std::string& getString() const;
00071 
00072   Point mouse_delta_;       
00073   Point mouse_;             
00074   bool button_[10];         
00075   bool button_pressed_[10]; 
00076   bool key_[SDLK_LAST];           
00077   bool key_pressed_[SDLK_LAST];   
00078 
00079 private:
00080   int modifier_;
00081   int modifier_pressed_;
00082 
00083   std::string lock_id_;
00084   bool key_lock_[SDLK_LAST];
00085   bool key_pressed_lock_[SDLK_LAST];
00086   std::string string_;
00087   std::string string_lock_;
00088 
00089   static Input* inst_;
00090 };
00091 
00092 #endif /* !INPUT_HH_ */

Generated on Sat Jun 23 16:07:23 2007 for Stechec/TBT by  doxygen 1.4.7