ScummVM API documentation
mouse.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 SWORD1_MOUSE_H
23 #define SWORD1_MOUSE_H
24 
25 #include "common/mutex.h"
26 #include "common/scummsys.h"
27 #include "common/rect.h"
28 #include "sword1/sworddefs.h"
29 #include "sword1/object.h"
30 
31 class OSystem;
32 
33 namespace Sword1 {
34 
35 #define MAX_MOUSE 30
36 
37 #define BS1L_BUTTON_DOWN 2
38 #define BS1L_BUTTON_UP 4
39 #define BS1R_BUTTON_DOWN 8
40 #define BS1R_BUTTON_UP 16
41 #define BS1_WHEEL_UP 32
42 #define BS1_WHEEL_DOWN 64
43 #define MOUSE_BOTH_BUTTONS (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
44 #define MOUSE_DOWN_MASK (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
45 #define MOUSE_UP_MASK (BS1L_BUTTON_UP | BS1R_BUTTON_UP)
46 
47 struct MouseObj {
48  int id;
49  Object *compact;
50 };
51 
52 #include "common/pack-start.h" // START STRUCT PACKING
53 
54 struct MousePtr {
55  uint16 numFrames;
56  uint16 sizeX;
57  uint16 sizeY;
58  uint16 hotSpotX;
59  uint16 hotSpotY;
60  uint8 dummyData[0x30];
61 } PACKED_STRUCT;
62 
63 #include "common/pack-end.h" // END STRUCT PACKING
64 
65 class Logic;
66 class Menu;
67 class ResMan;
68 class ObjectMan;
69 
70 class Mouse {
71 public:
72  Mouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
73  ~Mouse();
74  void initialize();
75  void addToList(int id, Object *compact);
76  void useLogicAndMenu(Logic *pLogic, Menu *pMenu);
77  void useScreenMutex(Common::Mutex *mutex);
78  void setLuggage(uint32 resID, uint32 rate);
79  void setPointer(uint32 resID, uint32 rate);
80  void animate();
81  void engine(uint16 x, uint16 y, uint16 eventFlags);
82  uint16 testEvent();
83  void giveCoords(uint16 *x, uint16 *y);
84  void fnNoHuman();
85  void fnAddHuman();
86  void fnBlankMouse();
87  void fnNormalMouse();
88  void fnLockMouse();
89  void fnUnlockMouse();
90  void controlPanel(bool on);
91 private:
92  void createPointer(uint32 ptrId, uint32 luggageId);
93  OSystem *_system;
94  Logic *_logic;
95  Menu *_menu;
96  MouseObj _objList[MAX_MOUSE];
97  ResMan *_resMan;
98  ObjectMan *_objMan;
99  Common::Point _mouse;
100  Common::Mutex *_screenAccessMutex;
101 
102  uint32 _currentPtrId, _currentLuggageId;
103  MousePtr *_currentPtr;
104  int _frame, _activeFrame;
105  uint16 _numObjs;
106  uint16 _lastState, _state;
107  uint32 _getOff;
108  bool _inTopMenu, _mouseOverride;
109 };
110 
111 } // End of namespace Sword1
112 
113 #endif //BSMOUSE_H
Definition: object.h:62
Definition: menu.h:65
Definition: resman.h:65
Definition: animation.h:38
Definition: mouse.h:54
Definition: logic.h:55
Definition: mutex.h:67
Definition: rect.h:45
Definition: objectman.h:33
Definition: mouse.h:70
Definition: mouse.h:47
Definition: system.h:161