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 CHEWY_CURSOR_H
23#define CHEWY_CURSOR_H
24
25#include "chewy/globals.h"
26
27namespace Chewy {
28
30 uint16 width;
31 uint16 height;
32 byte *data;
33};
34
35class Cursor {
36public:
37 Cursor();
38 ~Cursor();
39
40 void updateCursor();
41 void showCursor();
42 void hideCursor();
43 bool isCursorVisible() const;
44 void setAnimation(uint8 start, uint8 end, int16 delay);
45 void setCustomCursor(byte *data, uint16 width, uint16 height);
46 void setCustomRoomCursor(byte *roomSprite);
47 void clearCustomCursor();
48 void move(int16 x, int16 y);
49 uint8 getAnimStart() const { return _animStart; }
50
51 byte *getCursorSprite() const { return _currentCursor.data; }
52 uint16 getCursorWidth() const { return _currentCursor.width; }
53 uint16 getCursorHeight() const { return _currentCursor.height; }
54 byte *getCursorSprite(uint num) const { return _curSprites[num].data; }
55 uint16 getCursorWidth(uint num) const { return _curSprites[num].width; }
56 uint16 getCursorHeight(uint num) const { return _curSprites[num].height; }
57
58 void setInventoryCursor(int num) {
59 _invCursor = num;
60 if (num >= 0)
61 setAnimation(num, num, (1 + _G(gameState).DelaySpeed) * 5);
62 }
63 int getInventoryCursor() const { return _invCursor; }
64 bool usingInventoryCursor() const { return _invCursor >= 0; }
65
66private:
67 CursorSprite *_curSprites = nullptr;
68 CursorSprite _customCursor;
69 CursorSprite _currentCursor;
70 uint32 _cursorCount = 0;
71 uint32 _invCursorCount = 0;
72 int _invCursor = 0;
73
74 int16 _curAniCountdown = 0;
75 int16 _aniCount = 0;
76
77 uint8 _animStart = 0;
78 uint8 _animEnd = 0;
79 int16 _animDelay = 0;
80};
81
82} // namespace Chewy
83
84#endif
Definition: cursor.h:35
Definition: cursor.h:29