OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::ResourcePack Class Reference

Packs of external game media. More...

#include <ResourcePack.h>

Inheritance diagram for OpenXcom::ResourcePack:
OpenXcom::XcomResourcePack

Public Member Functions

 ResourcePack ()
 Create a new resource pack with a folder's contents. More...
 
virtual ~ResourcePack ()
 Cleans up the resource pack. More...
 
FontgetFont (const std::string &name) const
 Gets a particular font. More...
 
SurfacegetSurface (const std::string &name) const
 Gets a particular surface. More...
 
SurfaceSetgetSurfaceSet (const std::string &name) const
 Gets a particular surface set. More...
 
std::list< Polygon * > * getPolygons ()
 Gets the list of world polygons. More...
 
std::list< Polyline * > * getPolylines ()
 Gets the list of world polylines. More...
 
MusicgetMusic (const std::string &name) const
 Gets a particular music. More...
 
MusicgetRandomMusic (const std::string &name) const
 Gets a random music. More...
 
void playMusic (const std::string &name, bool random=false)
 Plays a particular music. More...
 
SoundgetSound (const std::string &set, unsigned int sound) const
 Gets a particular sound. More...
 
PalettegetPalette (const std::string &name) const
 Gets a particular palette. More...
 
void setPalette (SDL_Color *colors, int firstcolor=0, int ncolors=256)
 Sets a new palette. More...
 
std::vector< Uint16 > * getVoxelData ()
 Gets list of voxel data. More...
 

Detailed Description

Packs of external game media.

Resource packs contain all the game media that's loaded externally, like graphics, fonts, languages, audio and world map.

Note
The game is still hardcoded to X-Com resources, so for now this just serves to keep all the file loading in one place.

Constructor & Destructor Documentation

OpenXcom::ResourcePack::ResourcePack ( )

Create a new resource pack with a folder's contents.

Initializes a blank resource set pointing to a folder.

OpenXcom::ResourcePack::~ResourcePack ( )
virtual

Cleans up the resource pack.

Deletes all the loaded resources.

Member Function Documentation

Font * OpenXcom::ResourcePack::getFont ( const std::string &  name) const

Gets a particular font.

Returns a specific font from the resource set.

Parameters
nameName of the font.
Returns
Pointer to the font.
Music * OpenXcom::ResourcePack::getMusic ( const std::string &  name) const

Gets a particular music.

Returns a specific music from the resource set.

Parameters
nameName of the music.
Returns
Pointer to the music.
Palette * OpenXcom::ResourcePack::getPalette ( const std::string &  name) const

Gets a particular palette.

Returns a specific palette from the resource set.

Parameters
nameName of the palette.
Returns
Pointer to the palette.
std::list< Polygon * > * OpenXcom::ResourcePack::getPolygons ( )

Gets the list of world polygons.

Returns the list of polygons in the resource set.

Returns
Pointer to the list of polygons.
std::list< Polyline * > * OpenXcom::ResourcePack::getPolylines ( )

Gets the list of world polylines.

Returns the list of polylines in the resource set.

Returns
Pointer to the list of polylines.
Music * OpenXcom::ResourcePack::getRandomMusic ( const std::string &  name) const

Gets a random music.

Returns a random music from the resource set.

Parameters
nameName of the music to pick from.
Returns
Pointer to the music.
Sound * OpenXcom::ResourcePack::getSound ( const std::string &  set,
unsigned int  sound 
) const

Gets a particular sound.

Returns a specific sound from the resource set.

Parameters
setName of the sound set.
soundID of the sound.
Returns
Pointer to the sound.
Surface * OpenXcom::ResourcePack::getSurface ( const std::string &  name) const

Gets a particular surface.

Returns a specific surface from the resource set.

Parameters
nameName of the surface.
Returns
Pointer to the surface.
SurfaceSet * OpenXcom::ResourcePack::getSurfaceSet ( const std::string &  name) const

Gets a particular surface set.

Returns a specific surface set from the resource set.

Parameters
nameName of the surface set.
Returns
Pointer to the surface set.
std::vector< Uint16 > * OpenXcom::ResourcePack::getVoxelData ( )

Gets list of voxel data.

Returns the list of voxeldata in the resource set.

Returns
Pointer to the list of voxeldata.
void OpenXcom::ResourcePack::playMusic ( const std::string &  name,
bool  random = false 
)

Plays a particular music.

Plays the specified track if it's not already playing.

Parameters
nameName of the music.
randomPick a random track?
void OpenXcom::ResourcePack::setPalette ( SDL_Color *  colors,
int  firstcolor = 0,
int  ncolors = 256 
)

Sets a new palette.

Changes the palette of all the graphics in the resource set.

Parameters
colorsPointer to the set of colors.
firstcolorOffset of the first color to replace.
ncolorsAmount of colors to replace.

The documentation for this class was generated from the following files: