#include "Light.h" Light::Light() { SetLightIntensity(255, 255, 255); _active = true; } Light::Light(int red, int green, int blue) { SetLightIntensity(red, green, blue); _active = true; } Light::Light(const Light& other) { Copy(other); } Light::~Light() { } void Light::SetLightIntensity(int red, int green, int blue) { _liRed = BoundsCheck(0, 255, red); _liGreen = BoundsCheck(0, 255, green); _liBlue = BoundsCheck(0, 255, blue); } void Light::SetLightIntensity(ColRef color, int value) { int valueChecked = BoundsCheck(0, 255, value); switch (color) { default: case ColRef::Red: _liRed = valueChecked; break; case ColRef::Green: _liGreen = valueChecked; break; case ColRef::Blue: _liBlue = valueChecked; break; } } void Light::SetRedLightIntensity(int value) { SetLightIntensity(ColRef::Red, value); } void Light::SetGreenLightIntensity(int value) { SetLightIntensity(ColRef::Green, value); } void Light::SetBlueLightIntensity(int value) { SetLightIntensity(ColRef::Blue, value); } int Light::GetLightIntensity(ColRef color) const { int result; switch (color) { default: case ColRef::Red: result = _liRed; break; case ColRef::Green: result = _liGreen; break; case ColRef::Blue: result = _liBlue; break; } return result; } int Light::GetRedLightIntensity() const { return GetLightIntensity(ColRef::Red); } int Light::GetGreenLightIntensity() const { return GetLightIntensity(ColRef::Green); } int Light::GetBlueLightIntensity() const { return GetLightIntensity(ColRef::Blue); } bool Light::GetLightActive() const { return _active; } void Light::SetLightActive(bool active) { _active = active; } void Light::ToggleLightActive() { _active = !_active; } Light& Light::operator= (const Light& rhs) { if (this != &rhs) { Copy(rhs); } return *this; } void Light::Copy(const Light& other) { _liRed = other.GetRedLightIntensity(); _liGreen = other.GetGreenLightIntensity(); _liBlue = other.GetBlueLightIntensity(); _active = other.GetLightActive(); }