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 TWINE_KEYBOARD_H
23 #define TWINE_KEYBOARD_H
24 
25 #include "common/events.h"
26 #include "common/keyboard.h"
27 #include "common/scummsys.h"
28 #include "common/util.h"
29 #include "common/rect.h"
30 
31 namespace TwinE {
32 
33 class TwinEEngine;
34 
35 extern const char *mainKeyMapId;
36 extern const char *uiKeyMapId;
37 extern const char *cutsceneKeyMapId;
38 extern const char *holomapKeyMapId;
39 
40 enum TwinEActionType {
41  Pause,
42  NextRoom,
43  PreviousRoom,
44  ApplyCellingGrid,
45  IncreaseCellingGridIndex,
46  DecreaseCellingGridIndex,
47  DebugGridCameraPressUp,
48  DebugGridCameraPressDown,
49  DebugGridCameraPressLeft,
50  DebugGridCameraPressRight,
51  DebugPlaceActorAtCenterOfScreen,
52  DebugMenu,
53  DebugMenuActivate,
54  QuickBehaviourNormal,
55  QuickBehaviourAthletic,
56  QuickBehaviourAggressive,
57  QuickBehaviourDiscreet,
58  ChangeBehaviourNormal,
59  ChangeBehaviourAthletic,
60  ChangeBehaviourAggressive,
61  ChangeBehaviourDiscreet,
62  ExecuteBehaviourAction,
63  BehaviourMenu,
64  OptionsMenu,
65  RecenterScreenOnTwinsen,
66  UseSelectedObject,
67  ThrowMagicBall,
68  MoveForward,
69  MoveBackward,
70  TurnRight,
71  TurnLeft,
72  UseProtoPack,
73  OpenHolomap,
74  InventoryMenu,
75  SpecialAction,
76  SceneryZoom,
77  Escape,
78 
79  UIEnter,
80  UIAbort,
81  UILeft,
82  UIRight,
83  UIUp,
84  UIDown,
85  UINextPage,
86 
87  CutsceneAbort,
88 
89  HolomapAbort,
90  HolomapLeft,
91  HolomapRight,
92  HolomapUp,
93  HolomapDown,
94  HolomapNext,
95  HolomapPrev,
96 
97  Max
98 };
99 
104 private:
105  TwinEEngine* _engine;
106  bool _changed;
107  Common::String _keymap;
108 public:
109  ScopedKeyMap(TwinEEngine* engine, const char *id);
110  ~ScopedKeyMap();
111 };
112 
113 class Input {
114 private:
115  TwinEEngine *_engine;
116  Common::String _currentKeyMap;
117 
118  uint8 _actionStates[TwinEActionType::Max]{false};
119 public:
120  Input(TwinEEngine *engine);
121 
126  void enableKeyMap(const char *id);
127  bool enableAdditionalKeyMap(const char *id, bool enable);
128 
129  const Common::String currentKeyMap() const;
130 
138  bool isActionActive(TwinEActionType actionType, bool onlyFirstTime = true) const;
139 
140  bool isMouseHovering(const Common::Rect &rect) const;
141 
146  bool toggleActionIfActive(TwinEActionType actionType);
147  void resetActionStates();
148 
149  bool toggleAbortAction();
150 
151  bool isQuickBehaviourActionActive() const;
152  bool isMoveOrTurnActionActive() const;
153  bool isHeroActionActive() const;
154  bool resetHeroActions();
155 
160  Common::Point getMousePositions() const;
161 
165  void readKeys();
166  void processCustomEngineEventStart(const Common::Event& event);
167  void processCustomEngineEventEnd(const Common::Event& event);
168 };
169 
170 inline const Common::String Input::currentKeyMap() const {
171  return _currentKeyMap;
172 }
173 
174 } // namespace TwinE
175 
176 #endif
Definition: str.h:59
Definition: input.h:113
Definition: rect.h:144
Definition: events.h:198
Activates the given key map id that is registered in the meta engine.
Definition: input.h:103
Definition: rect.h:45
Definition: twine.h:200
Definition: achievements_tables.h:27