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 MOUSE_H 24 #define MOUSE_H 25 26 #include "backends/platform/psp/default_display_client.h" 27 28 class Cursor : public DefaultDisplayClient { 29 private: 30 int _hotspotX, _hotspotY; 31 uint32 _keyColor; 32 int _cursorTargetScale; 33 bool _useCursorPalette; 34 bool _hasCursorPalette; 35 uint32 _mouseLimitWidth; 36 uint32 _mouseLimitHeight; 37 int32 _x, _y; 38 Palette _screenPalette; // separate palette for screen. default 'palette' is cursor palette. 39 40 void updateRendererOffset(); 41 42 public: Cursor()43 Cursor() : _hotspotX(0), _hotspotY(0), _keyColor(0), _cursorTargetScale(0), 44 _useCursorPalette(false), _hasCursorPalette(false), _mouseLimitWidth(0), 45 _mouseLimitHeight(0), _x(0), _y(0) { } ~Cursor()46 virtual ~Cursor() { deallocate(); } 47 48 void setKeyColor(uint32 color); setCursorTargetScale(int scale)49 void setCursorTargetScale(int scale) { _cursorTargetScale = scale; } 50 void setScreenPalette(const byte *colors, uint start, uint num); 51 void copyFromArray(const byte *array); palette()52 Palette &palette() { return _palette; } buffer()53 Buffer &buffer() { return _buffer; } 54 void setCursorPalette(const byte *colors, uint start, uint num); 55 void enableCursorPalette(bool enable); isCursorPaletteEnabled()56 bool isCursorPaletteEnabled() const { return _useCursorPalette; } 57 void setLimits(uint32 width, uint32 height); 58 void setXY(int x, int y); getX()59 int32 getX() const { return _x; } getY()60 int32 getY() const { return _y; } 61 bool increaseXY(int32 incX, int32 incY); // returns true if there's a change in x or y 62 void adjustXYForScreenSize(int32 &x, int32 &y); 63 void init(); 64 void setHotspot(int32 x, int32 y); 65 void setScreenPaletteScummvmPixelFormat(const Graphics::PixelFormat *format); 66 void setSizeAndScummvmPixelFormat(uint32 widht, uint32 height, const Graphics::PixelFormat *format); 67 void clearKeyColor(); useGlobalScaler(bool val)68 void useGlobalScaler(bool val) { _renderer.setUseGlobalScaler(val); } 69 bool allocate(); 70 void deallocate(); 71 72 private: 73 void setSize(uint32 width, uint32 height); 74 void getPixelFormatsFromScummvmPixelFormat(const Graphics::PixelFormat *format, 75 PSPPixelFormat::Type &bufferFormat, 76 PSPPixelFormat::Type &paletteFormat, 77 uint32 &numOfEntries); 78 void setRendererModePalettized(bool palettized); 79 }; 80 81 #endif /* MOUSE_H */ 82