OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SurfaceSet.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_SURFACESET_H
20 #define OPENXCOM_SURFACESET_H
21 
22 #include <vector>
23 #include <map>
24 #include <string>
25 #include <SDL.h>
26 
27 namespace OpenXcom
28 {
29 
30 class Surface;
31 
39 {
40 private:
41  int _width, _height;
42  std::map<int, Surface*> _frames;
43 public:
45  SurfaceSet(int width, int height);
47  SurfaceSet(const SurfaceSet& other);
49  ~SurfaceSet();
51  void loadPck(const std::string &pck, const std::string &tab = "");
53  void loadDat(const std::string &filename);
55  Surface *getFrame(int i);
57  Surface *addFrame(int i);
59  int getWidth() const;
61  int getHeight() const;
63  size_t getTotalFrames() const;
65  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
66  std::map<int, Surface*> *getFrames();
67 };
68 
69 }
70 
71 #endif
void loadDat(const std::string &filename)
Loads an X-Com DAT image file.
Definition: SurfaceSet.cpp:158
void loadPck(const std::string &pck, const std::string &tab="")
Loads an X-Com set of PCK/TAB image files.
Definition: SurfaceSet.cpp:73
int getHeight() const
Gets the height of all frames.
Definition: SurfaceSet.cpp:248
size_t getTotalFrames() const
Gets the total frames in the set.
Definition: SurfaceSet.cpp:258
Container of a set of surfaces.
Definition: SurfaceSet.h:38
Surface * addFrame(int i)
Creates a new surface and returns a pointer to it.
Definition: SurfaceSet.cpp:229
SurfaceSet(int width, int height)
Crates a surface set with frames of the specified size.
Definition: SurfaceSet.cpp:33
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
Surface * getFrame(int i)
Gets a particular frame from the set.
Definition: SurfaceSet.cpp:215
int getWidth() const
Gets the width of all frames.
Definition: SurfaceSet.cpp:239
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the surface set's palette.
Definition: SurfaceSet.cpp:269
~SurfaceSet()
Cleans up the surface set.
Definition: SurfaceSet.cpp:56