chore: Add course material
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include "Light.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 << ")"
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
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; }
|
||||
Reference in New Issue
Block a user