X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fkaka%2Fcakelight%2FConsole.java;h=3b66959913a67cb0b3ff2afffd5573adf1c954a8;hb=eca6fd31ebbf5cc015c0a4acd4f1509de061e3df;hp=43ebd13e9516ec86960f24ecb76d8cbab566f328;hpb=8a0c98f8672e0b52a70f183c22421cf3d1033d9a;p=kaka%2Fcakelight.git diff --git a/src/kaka/cakelight/Console.java b/src/kaka/cakelight/Console.java index 43ebd13..3b66959 100644 --- a/src/kaka/cakelight/Console.java +++ b/src/kaka/cakelight/Console.java @@ -1,5 +1,10 @@ package kaka.cakelight; +import kaka.cakelight.mode.AmbientMode; +import kaka.cakelight.mode.SingleColorMode; +import kaka.cakelight.mode.TwoColorNoiseMode; +import kaka.cakelight.mode.VideoMode; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -47,11 +52,17 @@ public class Console extends Thread { ); cakelight.setMode(new SingleColorMode(c)); System.out.println("setting color to " + c); - } else if (input.matches("g|gamma\\s+[0-9.]+")) { + } else if (input.matches("(g|gamma)\\s+[0-9.]+")) { String[] split = input.split("\\s+"); config.gamma = Double.parseDouble(split[1]); + Color.calculateGammaCorrection(config.gamma); System.out.println("setting gamma to " + config.gamma); - break; + } else if (input.matches("(s|saturation)\\s+[0-9.]+")) { + String[] split = input.split("\\s+"); + config.video.saturation = Double.parseDouble(split[1]); + System.out.println("setting saturation to " + config.video.saturation); + } else if (input.matches("(n|noise)")) { + TwoColorNoiseMode.getCommand().activate(cakelight, config, input.split("\\s+")); } } catch (IOException e) { System.out.println("Error reading from command line"); @@ -59,4 +70,9 @@ public class Console extends Thread { } } } + + public interface Command { + String[] getNames(); + void activate(CakeLight cakelight, Configuration config, String[] args); + } }