public IStrip CreateStrip(StripConfig sc) { IStrip s; switch (sc.type) { case StripType.RGB: { s = new RGBStrip(sc.name, IPAddress.Parse(sc.address), sc.ledCount); } break; case StripType.RGBW: { s = new RGBWStrip(sc.name, IPAddress.Parse(sc.address), sc.ledCount); } break; case StripType.RGBW2D: { s = new RGBWStrip2D(sc.name, IPAddress.Parse(sc.address), sc.width, sc.height, sc.mirroredX); } break; default: { throw new ArgumentOutOfRangeException("Unsupported strip type"); } } s.Name = sc.name; return(s); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); this.height = config["height"]; this.Days = config["days"]; s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type Strip2D"); } }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type RGBWStrip2D"); } // TODO: Use magic to properly initialize 2d plugins var loc = config.location.Replace("(", "").Replace(")", "").Split(",").Select(x => int.Parse(x.Trim())); this.location = new Point(loc.ElementAt(0), loc.ElementAt(1)); //this.Font = this.FontCollection.Install("fonts/ostrich-sans-regular.ttf").CreateFont(22); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type RGBWStrip2D"); } baseURL = (string)config["baseURL"]; var tok = (JToken)config["busStops"]; var busstops = tok.ToObject <BusStop[]>(); var loc = config.location.Replace("(", "").Replace(")", "").Split(",").Select(x => int.Parse(x.Trim())); this.location = new Point(loc.ElementAt(0), loc.ElementAt(1)); stops = new StopCollection(baseURL, busstops); }
public override void Initialize(IStrip s, PluginConfig config) { base.Initialize(s, config); s2d = s as RGBWStrip2D; if (s2d == null) { throw new ArgumentException("Strip must be of type RGBWStrip2D"); } width = s2d.width; height = s2d.height; state = new bool[width, height]; // Generate random gamestate Random random = new Random(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { state[x, y] = random.Next(3) == 0; } } }