OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ResourcePack.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_RESOURCEPACK_H
20 #define OPENXCOM_RESOURCEPACK_H
21 
22 #include <map>
23 #include <string>
24 #include <list>
25 #include <vector>
26 #include <SDL.h>
27 
28 namespace OpenXcom
29 {
30 
31 class Surface;
32 class SurfaceSet;
33 class Font;
34 class Palette;
35 class Polygon;
36 class Polyline;
37 class Music;
38 class SoundSet;
39 class Sound;
40 
51 {
52 private:
53  Music *_muteMusic;
54  Sound *_muteSound;
55  std::string _playingMusic;
56 protected:
57  std::map<std::string, Palette*> _palettes;
58  std::map<std::string, Font*> _fonts;
59  std::map<std::string, Surface*> _surfaces;
60  std::map<std::string, SurfaceSet*> _sets;
61  std::map<std::string, SoundSet*> _sounds;
62  std::list<Polygon*> _polygons;
63  std::list<Polyline*> _polylines;
64  std::map<std::string, Music*> _musics;
65  std::vector<Uint16> _voxelData;
66 public:
68  ResourcePack();
70  virtual ~ResourcePack();
72  Font *getFont(const std::string &name) const;
74  Surface *getSurface(const std::string &name) const;
76  SurfaceSet *getSurfaceSet(const std::string &name) const;
78  std::list<Polygon*> *getPolygons();
80  std::list<Polyline*> *getPolylines();
82  Music *getMusic(const std::string &name) const;
84  Music *getRandomMusic(const std::string &name) const;
86  void playMusic(const std::string &name, bool random = false);
88  Sound *getSound(const std::string &set, unsigned int sound) const;
90  Palette *getPalette(const std::string &name) const;
92  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
94  std::vector<Uint16> *getVoxelData();
95 };
96 
97 }
98 
99 #endif
std::list< Polygon * > * getPolygons()
Gets the list of world polygons.
Definition: ResourcePack.cpp:122
Container for music tracks.
Definition: Music.h:32
virtual ~ResourcePack()
Cleans up the resource pack.
Definition: ResourcePack.cpp:47
Sound * getSound(const std::string &set, unsigned int sound) const
Gets a particular sound.
Definition: ResourcePack.cpp:217
Music * getMusic(const std::string &name) const
Gets a particular music.
Definition: ResourcePack.cpp:141
Container for sound effects.
Definition: Sound.h:32
void playMusic(const std::string &name, bool random=false)
Plays a particular music.
Definition: ResourcePack.cpp:187
Font * getFont(const std::string &name) const
Gets a particular font.
Definition: ResourcePack.cpp:90
std::list< Polyline * > * getPolylines()
Gets the list of world polylines.
Definition: ResourcePack.cpp:131
std::vector< Uint16 > * getVoxelData()
Gets list of voxel data.
Definition: ResourcePack.cpp:268
Container of a set of surfaces.
Definition: SurfaceSet.h:38
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:40
SurfaceSet * getSurfaceSet(const std::string &name) const
Gets a particular surface set.
Definition: ResourcePack.cpp:112
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
Packs of external game media.
Definition: ResourcePack.h:50
Palette * getPalette(const std::string &name) const
Gets a particular palette.
Definition: ResourcePack.cpp:235
Container for palettes (sets of 8bpp colors).
Definition: Palette.h:33
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets a new palette.
Definition: ResourcePack.cpp:247
Surface * getSurface(const std::string &name) const
Gets a particular surface.
Definition: ResourcePack.cpp:101
ResourcePack()
Create a new resource pack with a folder's contents.
Definition: ResourcePack.cpp:38
Music * getRandomMusic(const std::string &name) const
Gets a random music.
Definition: ResourcePack.cpp:159