23 lines
653 B
C++
23 lines
653 B
C++
|
|
|
|
#include "Light.h"
|
|
#include "CursesObj.h"
|
|
#include "Pelican.h"
|
|
#include "Screen.h"
|
|
#include <iostream>
|
|
|
|
Light::Light(std::string name, int x, int y, int color) : x(x), y(y), c(color), name(name) {}
|
|
|
|
Light::~Light() {
|
|
std::cout << "Deleting light (" << name << ", " << x << ", " << y << ", " << c << ")" << std::endl;
|
|
std::cout.flush();
|
|
}
|
|
|
|
void Light::set(LightState newState) {
|
|
state = newState;
|
|
Screen::write(name.c_str(), x, y, state == FLASH ? (128 + c) : (state == OFF ? 0 : c));
|
|
// 128 + color was used to make a character flash (but not any more)
|
|
}
|
|
|
|
Light::LightState Light::get(void) { return state; }
|