MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Keyboard.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Keyboard.h Keyboard input tracking system
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
27 #ifndef KEYBOARD_H
28 #define KEYBOARD_H
29 
30 #include <set>
31 #include "itype.h"
32 #include "SDL.h"
33 
34 namespace MFM {
35 
36  class Keyboard
37  {
38  private:
39  std::set<u32> m_current;
40  std::set<u32> m_prev;
41 
42  public:
43 
44  Keyboard() { }
45 
46  ~Keyboard() { }
47 
48  void HandleEvent(SDL_KeyboardEvent* e);
49 
50  void Press(u32 key);
51 
52  void Release(u32 key);
53 
54  bool ShiftHeld() const;
55 
56  bool CtrlHeld() const;
57 
58  bool AltHeld() const;
59 
60  bool IsDown(u32 key) const;
61 
62  bool IsUp(u32 key) const;
63 
64  bool SemiAuto(u32 key);
65 
66  void Flip();
67  };
68 } /* namespace MFM */
69 #endif /*KEYBOARD_H*/
Definition: Keyboard.h:36