git repos / blockattack-game

blame: source/code/sago/SagoSpriteHolder.hpp

normal view · raw

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