ScummVM API documentation
gr_tile_sprite.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 QDENGINE_SYSTEM_GRAPHICS_GR_TILE_SPRITE_H
23 #define QDENGINE_SYSTEM_GRAPHICS_GR_TILE_SPRITE_H
24 
25 namespace QDEngine {
26 
27 const int GR_TILE_SPRITE_SIZE_SHIFT = 4;
28 const int GR_TILE_SPRITE_SIZE_X = 1 << GR_TILE_SPRITE_SIZE_SHIFT;
29 const int GR_TILE_SPRITE_SIZE_Y = 1 << GR_TILE_SPRITE_SIZE_SHIFT;
30 
31 const int GR_TILE_SPRITE_SIZE = GR_TILE_SPRITE_SIZE_X * GR_TILE_SPRITE_SIZE_Y;
32 const int GR_TILE_SPRITE_SIZE_BYTES = GR_TILE_SPRITE_SIZE * 4;
33 
34 enum grTileCompressionMethod {
35  TILE_UNCOMPRESSED,
36  TILE_COMPRESS_RLE,
37  TILE_COMPRESS_LZ77
38 };
39 
41 
44 class grTileSprite {
45 public:
46  grTileSprite(const uint32 *data_ptr = 0);
47 
48  bool operator == (const grTileSprite &sprite) const;
49 
50  bool isEmpty() const {
51  return !_data;
52  }
53 
54  const uint32 *data() const {
55  return _data;
56  }
57 
58  static uint32 comprasionTolerance() {
59  return _comprasionTolerance;
60  }
61  static void setComprasionTolerance(uint32 value) {
62  _comprasionTolerance = value;
63  }
64 
65  static uint32 compress(const uint32 *in_data, uint32 *out_data, grTileCompressionMethod compress_method);
66  static bool uncompress(const uint32 *in_data, uint32 in_data_length, uint32 *out_data, grTileCompressionMethod compress_method);
67 
68 private:
69 
70  const uint32 *_data;
71 
73  static uint32 _comprasionTolerance;
74 };
75 
76 } // namespace QDEngine
77 
78 #endif // QDENGINE_SYSTEM_GRAPHICS_GR_TILE_SPRITE_H
Базовый класс для игровых ресурсов.
Definition: console.h:28
Тайл-спрайт
Definition: gr_tile_sprite.h:44