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 
27 class Cursor : public DefaultDisplayClient {
28 private:
29  int _hotspotX, _hotspotY;
30  uint32 _keyColor;
31  int _cursorTargetScale;
32  bool _useCursorPalette;
33  bool _hasCursorPalette;
34  uint32 _mouseLimitWidth;
35  uint32 _mouseLimitHeight;
36  int32 _x, _y;
37  Palette _screenPalette; // separate palette for screen. default 'palette' is cursor palette.
38  bool _fakeAlpha; // true if treating e.g. 555 as 5551, false if there's a genuine alpha channel
39 
40  void updateRendererOffset();
41 
42 public:
43  Cursor() : _hotspotX(0), _hotspotY(0), _keyColor(0), _cursorTargetScale(0),
44  _useCursorPalette(false), _hasCursorPalette(false), _mouseLimitWidth(0),
45  _mouseLimitHeight(0), _x(0), _y(0), _fakeAlpha(false) { }
46  virtual ~Cursor() { deallocate(); }
47 
48  void setKeyColor(uint32 color);
49  void setCursorTargetScale(int scale) { _cursorTargetScale = scale; }
50  void setScreenPalette(const byte *colors, uint start, uint num);
51  void copyFromArray(const byte *array);
52  Palette &palette() { return _palette; }
53  Buffer &buffer() { return _buffer; }
54  void setCursorPalette(const byte *colors, uint start, uint num);
55  void enableCursorPalette(bool enable);
56  bool isCursorPaletteEnabled() const { return _useCursorPalette; }
57  void setLimits(uint32 width, uint32 height);
58  void setXY(int x, int y);
59  int32 getX() const { return _x; }
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();
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 */
Definition: pixelformat.h:138
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: atari-cursor.h:38
Definition: display_client.h:113
Definition: default_display_client.h:28
Definition: atari-screen.h:44