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 /*
23  * This code is based on original Hugo Trilogy source code
24  *
25  * Copyright (c) 1989-1995 David P. Gray
26  *
27  */
28 
29 #ifndef HUGO_MOUSE_H
30 #define HUGO_MOUSE_H
31 
32 #include "hugo/game.h"
33 
34 namespace Common {
35 class ReadStream;
36 }
37 
38 namespace Hugo {
39 
40 class MouseHandler {
41 public:
43  void mouseHandler();
44 
45  void resetLeftButton();
46  void resetRightButton();
47  void setLeftButton();
48  void setRightButton();
49  void setJumpExitFl(bool fl);
50  void setMouseX(int x);
51  void setMouseY(int y);
52  void freeHotspots();
53 
54  bool getJumpExitFl() const;
55  int getMouseX() const;
56  int getMouseY() const;
57 
58  int16 getDirection(const int16 hotspotId) const;
59  int16 getHotspotActIndex(const int16 hotspotId) const;
60 
61  void drawHotspots() const;
62  int16 findExit(const int16 cx, const int16 cy, byte screenId);
63  void loadHotspots(Common::ReadStream &in);
64 
65 private:
66  HugoEngine *_vm;
67 
68  static const char kCursorNochar = '~'; // Don't show name of object under cursor
69  static const int kExitHotspot = -4; // Cursor over Exit hotspot
70  static const int kCursorNameIndex = 2; // Index of name used under cursor
71  static const int kCursorNameOffX = 10; // Cursor offset to name string
72  static const int kCursorNameOffY = -2; // Cursor offset to name string
73 
74  enum seqTextMouse {
75  kMsNoWayText = 0,
76  kMsExit = 1
77  };
78 
79  Hotspot *_hotspots;
80  bool _leftButtonFl; // Left mouse button pressed
81  bool _rightButtonFl; // Right button pressed
82  int _mouseX;
83  int _mouseY;
84  bool _jumpExitFl; // Allowed to jump to a screen exit
85 
86  void cursorText(const char *buffer, const int16 cx, const int16 cy, const Uif fontId, const int16 color);
87  void processRightClick(const int16 objId, const int16 cx, const int16 cy);
88  void processLeftClick(const int16 objId, const int16 cx, const int16 cy);
89  void readHotspot(Common::ReadStream &in, Hotspot &hotspot);
90 };
91 
92 } // End of namespace Hugo
93 
94 #endif //HUGO_MOUSE_H
Definition: console.h:27
Definition: hugo.h:168
Definition: mouse.h:40
Definition: algorithm.h:29
Definition: stream.h:385
Definition: hugo.h:189