ScummVM API documentation
background.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 DS_BACKGROUND_H
23 #define DS_BACKGROUND_H
24 
25 #include "common/rect.h"
26 
27 namespace Graphics {
28 struct Surface;
29 }
30 
31 namespace DS {
32 
33 class Background {
34 public:
35  Background(Graphics::Surface *surface, int layer, bool isSub, int mapBase, bool swScale);
36 
37  static size_t getRequiredVRAM(uint16 width, uint16 height, bool isRGB, bool swScale);
38 
39  void update();
40  void reset();
41 
42  void show();
43  void hide();
44  inline bool isVisible() const { return _visible; }
45 
46  void setScalef(int32 sx, int32 sy);
47  inline void setScale(int sx, int sy) { setScalef(sx << 8, sy << 8); }
48  void setScrollf(int32 x, int32 y);
49  inline void setScroll(int x, int y) { setScrollf(x << 8, y << 8); }
50 
51  Common::Point realToScaled(int16 x, int16 y) const;
52  Common::Point scaledToReal(int16 x, int16 y) const;
53 
54 protected:
55  int _bg;
56  bool _visible, _swScale;
57  uint16 _pitch;
58  int32 _scrollX, _scrollY, _scaleX, _scaleY;
59  Graphics::Surface *_surface;
60 };
61 
63 public:
64  TiledBackground(const unsigned int *tiles, size_t tilesLen, const unsigned short *map, size_t mapLen, int layer, bool isSub, int mapBase, int tileBase);
65 
66  void update();
67  void reset();
68 
69  void show();
70  void hide();
71  inline bool isVisible() const { return _visible; }
72 
73 protected:
74  const unsigned int *_tiles;
75  const unsigned short *_map;
76  size_t _tilesLen, _mapLen;
77 
78  int _bg;
79  bool _visible;
80 };
81 
82 } // End of namespace DS
83 
84 #endif // #ifndef DS_BACKGROUND_H
Definition: surface.h:67
Definition: background.h:33
Definition: formatinfo.h:28
Definition: background.h:31
Definition: rect.h:45
Definition: background.h:62