forked from stefanhendriks/Dune-II---The-Maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitRepository.hpp
32 lines (24 loc) · 911 Bytes
/
UnitRepository.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef UNITREPOSITORY_HPP
#define UNITREPOSITORY_HPP
#include "Unit.hpp"
#include "Player.hpp"
#include <map>
#include <SFML/Graphics/Texture.hpp>
class UnitRepository
{
public:
UnitRepository(MessageSystem& messages);
Unit create(Unit::Type type, const Player& player, sf::Vector2f position);
private:
std::map<Unit::Type, sf::Texture> unitTextures;
std::map<Unit::Type, sf::Texture> shadowTextures;
sf::Texture selectedTexture;
MessageSystem& messages;
int idCount;
const sf::Texture& getTexture(Unit::Type type, const sf::Color& color);
const sf::Texture& getShadow(Unit::Type type);
void recolor(sf::Image& image, const sf::Color& color) const;
sf::Texture load(const std::string& filename, const sf::Color& bitmask, const sf::Color& color = sf::Color(0,0,0,0)) const;
std::map<Unit::Type, std::string> filenames;
};
#endif // UNITREPOSITORY_HPP