| 1 | /* |
| 2 | Copyright (c) 2015 Poul Sander |
| 3 | |
| 4 | Permission is hereby granted, free of charge, to any person |
| 5 | obtaining a copy of this software and associated documentation files |
| 6 | (the "Software"), to deal in the Software without restriction, |
| 7 | including without limitation the rights to use, copy, modify, merge, |
| 8 | publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | and to permit persons to whom the Software is furnished to do so, |
| 10 | subject to the following conditions: |
| 11 | |
| 12 | The above copyright notice and this permission notice shall be |
| 13 | included in all copies or substantial portions of the Software. |
| 14 | |
| 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 19 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | #ifndef SAGOSPRITEHOLDER_HPP |
| 26 | #define SAGOSPRITEHOLDER_HPP |
| 27 | |
| 28 | #include "SagoDataHolder.hpp" |
| 29 | #include "SagoSprite.hpp" |
| 30 | #include <vector> |
| 31 | |
| 32 | namespace sago { |
| 33 | |
| 34 | class SagoSpriteHolder final { |
| 35 | public: |
| 36 | explicit SagoSpriteHolder(const SagoDataHolder& texHolder); |
| 37 | ~SagoSpriteHolder(); |
| 38 | /** |
| 39 | * Reads all the sprites from the "sprites" directory in alphabetical order |
| 40 | **/ |
| 41 | void ReadSprites(); |
| 42 | /** |
| 43 | * Reads an additional sprites. Used to append mod data. |
| 44 | **/ |
| 45 | void ReadSprites(const std::vector<std::string>& extra_sprites); |
| 46 | const sago::SagoSprite& GetSprite(const std::string& spritename) const; |
| 47 | const SagoDataHolder& GetDataHolder() const; |
| 48 | private: |
| 49 | SagoSpriteHolder(const SagoSpriteHolder& base) = delete; |
| 50 | SagoSpriteHolder& operator=(const SagoSpriteHolder& base) = delete; |
| 51 | void ReadSpriteFile(const std::string& filename); |
| 52 | struct SagoSpriteHolderData; |
| 53 | SagoSpriteHolderData* data; |
| 54 | }; |
| 55 | |
| 56 | } |
| 57 | |
| 58 | #endif /* SAGOSPRITEHOLDER_HPP */ |
| 59 |