ScummVM API documentation
palette.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 NEVERHOOD_PALETTE_H
23 #define NEVERHOOD_PALETTE_H
24 
25 #include "neverhood/neverhood.h"
26 #include "neverhood/entity.h"
27 
28 namespace Neverhood {
29 
30 class Palette : public Entity {
31 public:
32  // Default constructor with black palette
34  // Create from existing palette
35  Palette(NeverhoodEngine *vm, byte *palette);
36  // Create from resource with filename
37  Palette(NeverhoodEngine *vm, const char *filename);
38  // Create from resource with fileHash
39  Palette(NeverhoodEngine *vm, uint32 fileHash);
40  ~Palette() override;
41  void init();
42  void usePalette();
43  void addPalette(const char *filename, int toIndex, int count, int fromIndex);
44  void addPalette(uint32 fileHash, int toIndex, int count, int fromIndex);
45  void addBasePalette(uint32 fileHash, int toIndex, int count, int fromIndex);
46  void copyPalette(const byte *palette, int toIndex, int count, int fromIndex);
47  void copyBasePalette(int toIndex, int count, int fromIndex);
48  void startFadeToBlack(int counter);
49  void startFadeToWhite(int counter);
50  void startFadeToPalette(int counter);
51  void fillBaseWhite(int index, int count);
52  void fillBaseBlack(int index, int count);
53  void copyToBasePalette(byte *palette);
54 protected:
55  int _status;
56  byte *_palette;
57  byte *_basePalette;
58  int _palCounter;
59  byte _fadeToR, _fadeToG, _fadeToB;
60  int _fadeStep;
61  void update();
62  void fadeColor(byte *rgb, byte toR, byte toG, byte toB);
63  int calculateFadeStep(int counter);
64 };
65 
66 } // End of namespace Neverhood
67 
68 #endif /* NEVERHOOD_PALETTE_H */
Definition: background.h:30
Definition: neverhood.h:60
Definition: palette.h:30
Definition: entity.h:77