log("Running with config:\n" + config);
cakelight = new CakeLight(config, new LedController() {
@Override
- public void accept(LedFrame ledFrame) {
+ public void onFrame(LedFrame ledFrame) {
if (!paused) drawLEDs(canvas.getGraphicsContext2D(), ledFrame);
}
});
package kaka.cakelight;
-import java.util.function.Consumer;
-
-public class LedController implements Consumer<LedFrame> {
- @Override
- public void accept(LedFrame ledFrame) {
+public class LedController {
+ public void onFrame(LedFrame ledFrame) {
// TODO
}
}
import java.util.Optional;
import java.util.function.Consumer;
-public class VideoMode extends Mode implements Consumer<Optional<File>> {
+public class VideoMode extends Mode {
private Configuration config;
private Thread thread;
private Consumer<Frame> frameConsumer;
public VideoMode() {
deviceListener = new VideoDeviceListener();
- deviceListener.onVideoDeviceChange(this);
+ deviceListener.onVideoDeviceChange(this::onVideoDeviceChange);
}
@Override
frameListener.accept(frame.getLedFrame());
}
- @Override
- public void accept(Optional<File> videoDevice) {
+ public void onVideoDeviceChange(Optional<File> videoDevice) {
// Should only happen when this mode is active!
if (thread != null) {
thread.interrupt();