MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Mouse.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Mouse.h Mouse 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 MOUSE_H
28 #define MOUSE_H
29 
30 #include <set>
31 #include "itype.h"
32 #include "Point.h"
33 #include "SDL.h"
34 
35 namespace MFM {
36 
37  class Mouse
38  {
39  private:
40  std::set<u8> m_current;
41  std::set<u8> m_prev;
42 
43  u16 m_x, m_y;
44 
45  public:
46 
47  Mouse() { }
48 
49  ~Mouse() { }
50 
51  void HandleButtonEvent(SDL_MouseButtonEvent* e);
52 
53  void HandleMotionEvent(SDL_MouseMotionEvent* e);
54 
55  void Press(u8 button);
56 
57  void Release(u8 button);
58 
59  bool IsDown(u8 button);
60 
61  bool IsUp(u8 button);
62 
63  bool SemiAuto(u8 button);
64 
65  u16 GetX() { return m_x; }
66 
67  u16 GetY() { return m_y; }
68 
69  void FillPoint(SPoint* out);
70 
71  /*
72  * This should be called once a
73  * frame to keep the SemiAuto
74  * function working.
75  */
76  void Flip();
77  };
78 } /* namespace MFM */
79 #endif /*MOUSE_H*/
Definition: Mouse.h:37