ScummVM API documentation
game_palettes.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 DGDS_GAME_PALETTES_H
23 #define DGDS_GAME_PALETTES_H
24 
25 #include "common/error.h"
26 #include "common/str.h"
27 #include "common/serializer.h"
28 #include "graphics/palette.h"
29 
30 namespace Dgds {
31 
32 class Decompressor;
33 class ResourceManager;
34 
35 class DgdsPal : public Graphics::Palette {
36 public:
37  DgdsPal();
38  virtual ~DgdsPal() {}
39  const Common::String &getName() { return _name; }
40  void setName(const Common::String &name) { _name = name; }
41 private:
42  Common::String _name;
43 };
44 
45 class GamePalettes {
46 public:
47  GamePalettes(ResourceManager *resourceMan, Decompressor *decompressor);
48  int loadPalette(const Common::String &filename);
49  void selectPalNum(int num);
50  void setPalette();
51  void clearPalette();
52 
53  // Reset the list to the post-game-load state (1 palette loaded)
54  void reset();
55 
56  // Fade the colors in the current palette toward black. Start at col, and fade ncols of the palette.
57  // Add coloff to the result to move toward white.
58  void setFade(int col, int ncols, int coloff, int fade);
59 
60  Common::Error syncState(Common::Serializer &s);
61 
62  uint getCurPalNum() const { return _curPalNum; }
63 
64 private:
65  ResourceManager *_resourceMan;
66  Decompressor *_decompressor;
67 
68  DgdsPal _curPal;
69  uint _curPalNum;
70  Common::Array<DgdsPal> _palettes;
71 };
72 
73 } // end namespace Dgds
74 
75 #endif // DGDS_GAME_PALETTES_H
Definition: str.h:59
Definition: game_palettes.h:45
Definition: error.h:84
Definition: array.h:52
Definition: ads.h:28
Definition: serializer.h:79
Definition: game_palettes.h:35
Simple class for handling a palette data.
Definition: palette.h:45
Definition: decompress.h:67
Definition: resource.h:49