ScummVM API documentation
cursor.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 LASTEXPRESS_CURSOR_H
23 #define LASTEXPRESS_CURSOR_H
24 
25 /*
26  Cursor format (CURSORS.TBM)
27 
28  style table:
29  (for each cursor)
30  uint16 {2} - hotspot X
31  uint16 {2} - hotspot Y
32 
33  data:
34  (for each cursor)
35  uint16 {32*32} - cursor data
36 */
37 
38 #include "lastexpress/drawable.h"
39 
40 #include "lastexpress/shared.h"
41 
42 namespace Common {
43 class SeekableReadStream;
44 }
45 
46 namespace LastExpress {
47 
48 class Icon : public Drawable {
49 public:
50  Icon(CursorStyle style);
51 
52  void setPosition(int16 x, int16 y);
53  void setBrightness(int16 brightnessIndex);
54  Common::Rect draw(Graphics::Surface *surface) override;
55 
56 private:
57  CursorStyle _style;
58  int16 _x, _y;
59  int16 _brightnessIndex;
60 };
61 
62 class Cursor {
63 public:
64  Cursor();
65 
66  bool load(Common::SeekableReadStream *stream);
67  void show(bool visible) const;
68 
69  void setStyle(CursorStyle style);
70  CursorStyle getStyle() const { return _current; }
71 
72 private:
73  // Style
74  CursorStyle _current;
75 
76  // Cursors data
77  struct {
78  uint16 image[32 * 32];
79  uint16 hotspotX, hotspotY;
80  } _cursors[kCursorMAX];
81 
82  bool checkStyle(CursorStyle style) const;
83  const uint16 *getCursorImage(CursorStyle style) const;
84 
85  // Only allow full access for drawing (needed for getCursorImage)
86  friend Common::Rect Icon::draw(Graphics::Surface *surface);
87 };
88 
89 } // End of namespace LastExpress
90 
91 #endif // LASTEXPRESS_CURSOR_H
Definition: surface.h:67
Definition: rect.h:144
Definition: stream.h:745
Definition: animation.h:45
Definition: drawable.h:29
Definition: cursor.h:62
Definition: cursor.h:48
Definition: algorithm.h:29