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 PARALLACTION_INPUT_H
23 #define PARALLACTION_INPUT_H
24 
25 #include "common/keyboard.h"
26 
27 #include "parallaction/objects.h"
28 #include "parallaction/inventory.h"
29 
30 namespace Parallaction {
31 
32 enum {
33  kMouseNone = 0,
34  kMouseLeftUp = 1,
35  kMouseLeftDown = 2,
36  kMouseRightUp = 4,
37  kMouseRightDown = 8
38 };
39 
40 enum MouseTriState {
41  MOUSE_ENABLED_SHOW,
42  MOUSE_ENABLED_HIDE,
43  MOUSE_DISABLED
44 };
45 
46 class Input {
47  int updateGameInput();
48 
49  bool _hasKeyPressEvent;
50  Common::KeyState _keyPressed;
51 
52  bool _hasDelayedAction; // actived when the character needs to move before taking an action
53  ZonePtr _delayedActionZone;
54 
55  int16 _transCurrentHoverItem;
56 
57  void translateInput();
58  bool translateGameInput();
59  bool updateInventoryInput();
60  void takeAction(ZonePtr z);
61  void walkTo(const Common::Point &dest);
62 
63  Parallaction *_vm;
64 
65  Common::Point _mousePos;
66  uint16 _mouseButtons;
67 
68  ZonePtr _hoverZone;
69 
70  void enterInventoryMode();
71  void exitInventoryMode();
72 
73  int _gameType;
74 
75  static byte _resMouseArrow_NS[256];
76  static byte _resMouseArrow_BR_Amiga[512];
77  Frames *_mouseArrow;
78  Frames *_comboArrow;
79  Frames *_dinoCursor;
80  Frames *_dougCursor;
81  Frames *_donnaCursor;
82 
83  void initCursors();
84 
85 public:
86  enum {
87  kInputModeGame = 0,
88  kInputModeComment = 1,
89  kInputModeDialogue = 2,
90  kInputModeInventory = 3,
91  kInputModeMenu = 4
92  };
93 
94 
95  Input(Parallaction *vm);
96  virtual ~Input();
97 
98  void getAbsoluteCursorPos(Common::Point& p) const;
99 
100  void getCursorPos(Common::Point& p) const {
101  p = _mousePos;
102  }
103 
104  void setCursorPos(const Common::Point& p) {
105  _mousePos = p;
106  }
107 
108  int _inputMode;
109  InventoryItem _activeItem;
110 
111  void readInput();
112  int updateInput();
113  void trackMouse(ZonePtr z);
114  void waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1);
115  uint32 getLastButtonEvent() { return _mouseButtons; }
116  bool getLastKeyDown(uint16 &ascii);
117 
118  void stopHovering();
119 
120  MouseTriState _mouseState;
121 
122  void setMouseState(MouseTriState state);
123  MouseTriState getMouseState();
124  bool isMouseEnabled();
125 
126  void setArrowCursor();
127  void setInventoryCursor(ItemName name);
128 
129  void setMenuPointer();
130  void setCharacterPointer(const char *name);
131 };
132 
133 } // namespace Parallaction
134 
135 #endif
Definition: inventory.h:32
Definition: debug.h:8
Definition: input.h:46
Definition: rect.h:45
Definition: keyboard.h:294
Definition: graphics.h:73