From 98ba22e7064db57316dfff1ae127feb3dceeb73e Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Thu, 31 Jul 2014 13:58:22 +0200 Subject: Initial commit --- source/presentation/ColourStore.h | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 source/presentation/ColourStore.h (limited to 'source/presentation/ColourStore.h') diff --git a/source/presentation/ColourStore.h b/source/presentation/ColourStore.h new file mode 100644 index 0000000..8985099 --- /dev/null +++ b/source/presentation/ColourStore.h @@ -0,0 +1,60 @@ +#ifndef COLOURSTORE_H +#define COLOURSTORE_H + +#include + +#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 _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 -- cgit v1.2.3