A repository of knowledge about a .tex file. An ImageSet is a data structure that describes a .tex file and a way of knowing what is in that .tex file so that the images contained in it can be used in the rest of the game. When a RuleSet is loaded, its ImageSets are given to the IImageEngine which manages them and provides access for the rest of the modules.
All ImageSets are accessed by ‘keys’, which are string values that name groups of images. It may be that multiple ImageSets may have the same key if they are all extensions for a certain kind of image. For instance, all tile images are referenced by the key ‘TileType’ and there may be several ImageSets that provide images for tiles, so they would all have the same key.
ImageSets also contain a string hash that maps a string name to the index into the images in the .tex file. When an ImageSet is created, its hash must be filled with data that corresponds to the layout of the .tex file it is supposed to represent. This allows for objects that need to use the images in the .tex file to ask for a particular image by name, and the hash maps the name to the index into the .tex file of the image to return. In this way, all image requests can be done without the use of difficult and error-prone number indices, but rather through simple strings.
ImageSet.h
A repository of knowledge about a .tex file. | |
The ImageSet constructor. | |
Returns the number of images in the .tex file the ImageSet describes. | |
Returns the key used to group the images in the ImageSet. | |
Returns the file name of the .tex file the ImageSet describes. | |
Returns the index in the .tex file of the given image name. | |
Sets the index in the .tex file of the given image name. | |
Provides an iterator to the start of the .tex file index hash. | |
Provides an iterator to the end of the .tex file index hash. | |
The key used to group the ImageSet. | |
The .tex file the ImageSet describes. | |
The hash map of strings that name the images contained in the .tex file to their index in that .tex file. |
The ImageSet constructor. | |
Returns the number of images in the .tex file the ImageSet describes. | |
Returns the key used to group the images in the ImageSet. | |
Returns the file name of the .tex file the ImageSet describes. | |
Returns the index in the .tex file of the given image name. | |
Sets the index in the .tex file of the given image name. | |
Provides an iterator to the start of the .tex file index hash. | |
Provides an iterator to the end of the .tex file index hash. |
|
The ImageSet constructor. Stores the given key and .tex file name.
| key | The key for this ImageSet. See ImageSet for more details. |
| file | The name of the .tex file this ImageSet describes. |
|
| wxInt32 numImages() const |
| const wxString &key() const |
| const wxString &file() const |
|
| IntHash::const_iterator hash_begin() const |
| IntHash::const_iterator hash_end() const |
| wxString mKey |
| wxString mFile |
| IntHash mIndexHash |