chore: Add course material
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "Light.h"
|
||||
#include "PoleVisitor.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 << ")"
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
void Light::accept(PoleVisitor &pv) { pv.visit(*this); }
|
||||
|
||||
void Light::set(LightState new_state) { state = new_state; }
|
||||
|
||||
Light::LightState Light::get(void) { return state; }
|
||||
|
||||
int Light::getColor(void) { return state == OFF ? 0 : (state == FLASH ? 128 + c : c); }
|
||||
|
||||
std::string Light::getString() { return name; }
|
||||
|
||||
int Light::getX() { return x; }
|
||||
|
||||
int Light::getY() { return y; }
|
||||
Reference in New Issue
Block a user