summaryrefslogtreecommitdiff
path: root/source/presentation/ColourStore.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/presentation/ColourStore.h')
-rw-r--r--source/presentation/ColourStore.h60
1 files changed, 60 insertions, 0 deletions
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 <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