summaryrefslogtreecommitdiff
path: root/source/presentation/ColourStore.h
blob: 8985099b7ab66c2d33fdfa4b478d0e0eaa13b951 (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef COLOURSTORE_H
#define COLOURSTORE_H

#include <allegro5/allegro.h>

#include "../presentation/BitmapStore.h"

/**
* @brief Class for mapping BitmapStore images to colours for use in the minimap.
*
* @author Justin Wernick
* @author David Schneider
*/
class ColourStore
{
    public:
        /**
        * @brief Creates the ColourStore object and initialises all of the colours.
        */
        ColourStore();

        /**
        * @brief Returns the colour associated with a given image.
        *
        * If no colour makes sense for the image, then when it is requested a colour
        * with an alpha of 0 (completely transparent) is returned.
        *
        * @param [in] image The BitmapStore image to be associated with a colour.
        *
        * @return The requested colour.
        */
        ALLEGRO_COLOR getColour(BitmapStore::Image image);
    private:
        /**
        * @brief Unimplemented copy constructor, prevents copying of ColourStore objects.
        *
        * Copying a ColourStore is unneccesary as there should only be a single ColourStore object.
        */
        ColourStore(const ColourStore& ref);
        /**
        * @brief Unimplemented assignment operator.
        *
        * @see ColourStore(const ColourStore& ref);
        */
        ColourStore& operator=(const ColourStore& rhs);

        map<BitmapStore::Image, ALLEGRO_COLOR> _colours;

        /**
        * @brief Initialised to have an alpha of 0, and returned when the colour of an unlisted image is requested.
        */
        ALLEGRO_COLOR _transparent;

        /**
        * @brief Initialises all of the relevant colours.
        */
        void populateColours();
};

#endif // COLOURSTORE_H