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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef LASTEXPRESS_CURSOR_H 24 #define LASTEXPRESS_CURSOR_H 25 26 /* 27 Cursor format (CURSORS.TBM) 28 29 style table: 30 (for each cursor) 31 uint16 {2} - hotspot X 32 uint16 {2} - hotspot Y 33 34 data: 35 (for each cursor) 36 uint16 {32*32} - cursor data 37 */ 38 39 #include "lastexpress/drawable.h" 40 41 #include "lastexpress/shared.h" 42 43 namespace Common { 44 class SeekableReadStream; 45 } 46 47 namespace LastExpress { 48 49 class Icon : public Drawable { 50 public: 51 Icon(CursorStyle style); 52 53 void setPosition(int16 x, int16 y); 54 void setBrightness(int16 brightnessIndex); 55 Common::Rect draw(Graphics::Surface *surface); 56 57 private: 58 CursorStyle _style; 59 int16 _x, _y; 60 int16 _brightnessIndex; 61 }; 62 63 class Cursor { 64 public: 65 Cursor(); 66 67 bool load(Common::SeekableReadStream *stream); 68 void show(bool visible) const; 69 70 void setStyle(CursorStyle style); getStyle()71 CursorStyle getStyle() const { return _current; } 72 73 private: 74 // Style 75 CursorStyle _current; 76 77 // Cursors data 78 struct { 79 uint16 image[32 * 32]; 80 uint16 hotspotX, hotspotY; 81 } _cursors[kCursorMAX]; 82 83 bool checkStyle(CursorStyle style) const; 84 const uint16 *getCursorImage(CursorStyle style) const; 85 86 // Only allow full access for drawing (needed for getCursorImage) 87 friend Common::Rect Icon::draw(Graphics::Surface *surface); 88 }; 89 90 } // End of namespace LastExpress 91 92 #endif // LASTEXPRESS_CURSOR_H 93