aboutsummaryrefslogtreecommitdiffstats
path: root/include/color.hpp
diff options
context:
space:
mode:
authorAndy <drumsetmonkey@gmail.com>2017-01-20 10:37:21 -0500
committerAndy <drumsetmonkey@gmail.com>2017-01-20 10:37:21 -0500
commit4d8f9974156068e4595bf219cacfd9fcd2fd7174 (patch)
treef3e938c0e49537a9dea661f46eed6ee74950b48a /include/color.hpp
parent1894e311bdeb098c3bef9bd342e0eaf78d197a9b (diff)
parent1ac412a5496fb6c63c47f199dfc7facd5f4c080a (diff)
Merge branch 'master' of https://github.com/tcsullivan/gamedev
Diffstat (limited to 'include/color.hpp')
-rw-r--r--include/color.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/color.hpp b/include/color.hpp
new file mode 100644
index 0000000..2c89a1c
--- /dev/null
+++ b/include/color.hpp
@@ -0,0 +1,26 @@
+#ifndef COLOR_HPP_
+#define COLOR_HPP_
+
+/**
+ * Keeps track of an RGBA color.
+ */
+class Color{
+public:
+ float red; /**< The amount of red, 0-255 or 0.0-1.0 depending on usage */
+ float green; /**< The amount of green */
+ float blue; /**< The amount of blue */
+ float alpha; /**< Transparency */
+
+ Color(float r = 0, float g = 0, float b = 0, float a = 255)
+ : red(r), green(g), blue(b), alpha(a) {}
+
+ Color operator-(const float& a) {
+ return Color(red - a, green - a, blue - a, alpha);
+ }
+
+ Color operator+(const float& a) {
+ return Color(red + a, green + a, blue + a, alpha);
+ }
+};
+
+#endif // COLOR_HPP_