OpenXcom  1.0
Open-source clone of the original X-Com
SurfaceSet.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom 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  * OpenXcom 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 OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <map>
21 #include <string>
22 #include <SDL.h>
23 
24 namespace OpenXcom
25 {
26 
27 class Surface;
28 
36 {
37 private:
38  int _width, _height;
39  std::map<int, Surface*> _frames;
40 public:
42  SurfaceSet(int width, int height);
44  SurfaceSet(const SurfaceSet& other);
46  ~SurfaceSet();
48  void loadPck(const std::string &pck, const std::string &tab = "");
50  void loadDat(const std::string &filename);
52  Surface *getFrame(int i);
54  Surface *addFrame(int i);
56  int getWidth() const;
58  int getHeight() const;
60  size_t getTotalFrames() const;
62  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
63  std::map<int, Surface*> *getFrames();
64 };
65 
66 }
void loadDat(const std::string &filename)
Loads an X-Com DAT image file.
Definition: SurfaceSet.cpp:169
void loadPck(const std::string &pck, const std::string &tab="")
Loads an X-Com set of PCK/TAB image files.
Definition: SurfaceSet.cpp:72
size_t getTotalFrames() const
Gets the total frames in the set.
Definition: SurfaceSet.cpp:269
Container of a set of surfaces.
Definition: SurfaceSet.h:35
Surface * addFrame(int i)
Creates a new surface and returns a pointer to it.
Definition: SurfaceSet.cpp:240
int getHeight() const
Gets the height of all frames.
Definition: SurfaceSet.cpp:259
SurfaceSet(int width, int height)
Crates a surface set with frames of the specified size.
Definition: SurfaceSet.cpp:32
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
Surface * getFrame(int i)
Gets a particular frame from the set.
Definition: SurfaceSet.cpp:226
int getWidth() const
Gets the width of all frames.
Definition: SurfaceSet.cpp:250
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the surface set&#39;s palette.
Definition: SurfaceSet.cpp:280
~SurfaceSet()
Cleans up the surface set.
Definition: SurfaceSet.cpp:55
Definition: BaseInfoState.cpp:40