#include "Color.hpp"
#include "Graphics.hpp"
#ifdef _MSC_VER
  #include <windows.h>
  #define GLEW_STATIC
  #include <GL/glew.h>
#else
  #include <GL/gl.h>
#endif

const Color Color::White;
const Color Color::Black = Color(0, 0, 0);
const Color Color::Cyan = Color(0, 1, 1);
const Color Color::Magenta = Color(1, 0, 1);

void Color::render() const {
  glColor3d(
    r,
    g,
    b
  );
}

Color::Color(
  const double r,
  const double g,
  const double b
) {
  this->r = r;
  this->g = g;
  this->b = b;
}

Color& Color::operator += (const Color& c) {
  r += c.r;
  g += c.g;
  b += c.b;
  return *this;
}

Color& Color::operator -= (const Color& c) {
  r -= c.r;
  g -= c.g;
  b -= c.b;
  return *this;
}

Color& Color::operator *= (const double f) {
  r *= f;
  g *= f;
  b *= f;
  return *this;
}

Color& Color::operator /= (const double f) {
  if (f != 0) {
    r /= f;
    g /= f;
    b /= f;
  }
  return *this;
}

