ScummVM API documentation
input.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ALCACHOFA_INPUT_H
23 #define ALCACHOFA_INPUT_H
24 
25 #include "common/events.h"
26 #include "common/ptr.h"
27 
28 namespace Alcachofa {
29 
30 class Input {
31 public:
32  inline bool wasMouseLeftPressed() const { return _wasMouseLeftPressed; }
33  inline bool wasMouseRightPressed() const { return _wasMouseRightPressed; }
34  inline bool wasAnyMousePressed() const { return _wasMouseLeftPressed || _wasMouseRightPressed; }
35  inline bool wasMouseLeftReleased() const { return _wasMouseLeftReleased; }
36  inline bool wasMouseRightReleased() const { return _wasMouseRightReleased; }
37  inline bool wasAnyMouseReleased() const { return _wasMouseLeftReleased || _wasMouseRightReleased; }
38  inline bool isMouseLeftDown() const { return _isMouseLeftDown; }
39  inline bool isMouseRightDown() const { return _isMouseRightDown; }
40  inline bool isAnyMouseDown() const { return _isMouseLeftDown || _isMouseRightDown; }
41  inline bool wasMenuKeyPressed() const { return _wasMenuKeyPressed; }
42  inline bool wasInventoryKeyPressed() const { return _wasInventoryKeyPressed; }
43  inline Common::Point mousePos2D() const { return _mousePos2D; }
44  inline Common::Point mousePos3D() const { return _mousePos3D; }
45  const Input &debugInput() const { scumm_assert(_debugInput != nullptr); return *_debugInput; }
46 
47  void nextFrame();
48  bool handleEvent(const Common::Event &event);
49  void toggleDebugInput(bool debugMode);
50 
51 private:
52  void updateMousePos3D();
53 
54  bool
55  _wasMouseLeftPressed = false,
56  _wasMouseRightPressed = false,
57  _wasMouseLeftReleased = false,
58  _wasMouseRightReleased = false,
59  _isMouseLeftDown = false,
60  _isMouseRightDown = false,
61  _wasMenuKeyPressed = false,
62  _wasInventoryKeyPressed = false;
64  _mousePos2D,
65  _mousePos3D;
66  Common::ScopedPtr<Input> _debugInput;
67 };
68 
69 }
70 
71 #endif // ALCACHOFA_INPUT_H
Definition: alcachofa.h:45
void toggleDebugInput(bool debugMode)
Toggles input debug mode which blocks any input not retrieved with debugInput.
Definition: ptr.h:572
Definition: events.h:210
Definition: rect.h:144
Definition: input.h:30