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 MOUSE_H
23 #define MOUSE_H
24 
25 #include "backends/platform/psp/default_display_client.h"
26 #include "graphics/blit.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  bool _fakeAlpha; // true if treating e.g. 555 as 5551, false if there's a genuine alpha channel
40  Graphics::PixelFormat _srcFormat;
41  Graphics::PixelFormat _dstFormat;
42  Graphics::FastBlitFunc _blitFunc;
43 
44  void updateRendererOffset();
45 
46 public:
47  Cursor() : _hotspotX(0), _hotspotY(0), _keyColor(0), _cursorTargetScale(0),
48  _useCursorPalette(false), _hasCursorPalette(false), _mouseLimitWidth(0),
49  _mouseLimitHeight(0), _x(0), _y(0), _fakeAlpha(false) { }
50  virtual ~Cursor() { deallocate(); }
51 
52  void setKeyColor(uint32 color);
53  void setCursorTargetScale(int scale) { _cursorTargetScale = scale; }
54  void setScreenPalette(const byte *colors, uint start, uint num);
55  void copyFromArray(const byte *array);
56  Palette &palette() { return _palette; }
57  Buffer &buffer() { return _buffer; }
58  void setCursorPalette(const byte *colors, uint start, uint num);
59  void enableCursorPalette(bool enable);
60  bool isCursorPaletteEnabled() const { return _useCursorPalette; }
61  void setLimits(uint32 width, uint32 height);
62  void setXY(int x, int y);
63  int32 getX() const { return _x; }
64  int32 getY() const { return _y; }
65  bool increaseXY(int32 incX, int32 incY); // returns true if there's a change in x or y
66  void adjustXYForScreenSize(int32 &x, int32 &y);
67  void init();
68  void setHotspot(int32 x, int32 y);
69  void setScreenPaletteScummvmPixelFormat(const Graphics::PixelFormat *format);
70  void setSizeAndScummvmPixelFormat(uint32 widht, uint32 height, const Graphics::PixelFormat *format);
71  void clearKeyColor();
72  void useGlobalScaler(bool val) { _renderer.setUseGlobalScaler(val); }
73  bool allocate();
74  void deallocate();
75 
76 private:
77  void setSize(uint32 width, uint32 height);
78  void getPixelFormatsFromScummvmPixelFormat(const Graphics::PixelFormat *format,
79  PSPPixelFormat::Type &bufferFormat,
80  PSPPixelFormat::Type &paletteFormat,
81  uint32 &numOfEntries);
82  void setRendererModePalettized(bool palettized);
83 };
84 
85 #endif /* MOUSE_H */
Definition: pixelformat.h:138
Definition: atari-cursor.h:35
Definition: display_client.h:113
Definition: default_display_client.h:31
Definition: atari-screen.h:42