void RaveParty() { pixelMatrix = new byte[307200]; RandomColor(); for (int i = 0; i < 307200; i++) { if ((i % 1) == 0) { pixelMatrix[i] = (byte)blue; // blue } if ((i % 2) == 0) { pixelMatrix[i] = (byte)green; // green } if ((i % 3) == 0) { pixelMatrix[i] = (byte)red; // red } if ((i % 4) == 0) { pixelMatrix[i] = (byte)alpha; // red } } RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(0, "JUST", red, blue, green); RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(1, "LIVING", red, blue, green); RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(2, "IN", red, blue, green); RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(3, "THE", red, blue, green); RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(4, "DATABASE", red, blue, green); RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(5, "WOH ", red, blue, green); RandomColor(); LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(6, "OWW", red, blue, green); }
// set background static public void SetBackground() { try { // use background from folder Image img = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + @"background.jpg"); Bitmap bitmapImage = new Bitmap(img); // convert to byte byte[] pix = utils.GetPixel(bitmapImage); //set background WriteDebugMessage("Background Set: " + LogitechGSDK.LogiLcdColorSetBackground(pix)); } catch (Exception ex) { WriteDebugMessage("Could not load background image: " + ex.ToString()); } LogitechGSDK.LogiLcdUpdate(); }
// Update is called once per frame void Update() { //BUTTON TEST String colorButtons = ""; String monoButtons = ""; if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_CANCEL)) { colorButtons += "Cancel"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_DOWN)) { colorButtons += "Down"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_LEFT)) { colorButtons += "Left"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_MENU)) { colorButtons += "Menu"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_OK)) { colorButtons += "Ok"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_RIGHT)) { colorButtons += "Right"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_UP)) { colorButtons += "Up"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_0)) { monoButtons += "Button 0"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_1)) { monoButtons += "Button 1"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_2)) { monoButtons += "Button 2"; } if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_MONO_BUTTON_3)) { monoButtons += "Button 3"; } LogitechGSDK.LogiLcdMonoSetText(0, monoButtons); LogitechGSDK.LogiLcdColorSetText(5, colorButtons, 255, 255, 0); //LCD TYPE CONNECTED TEST String lcdsConnected = "LCDs connected :"; if (LogitechGSDK.LogiLcdIsConnected(LogitechGSDK.LOGI_LCD_TYPE_MONO)) { lcdsConnected += "MONO "; } if (LogitechGSDK.LogiLcdIsConnected(LogitechGSDK.LOGI_LCD_TYPE_COLOR)) { lcdsConnected += "COLOR"; } LogitechGSDK.LogiLcdMonoSetText(1, lcdsConnected); LogitechGSDK.LogiLcdColorSetText(2, lcdsConnected, 255, 255, 0); LogitechGSDK.LogiLcdUpdate(); if (Input.GetKey(KeyCode.Mouse0)) { //COLOR TEST pixelMatrix = new byte[307200]; int red = 0; int blue = 0; int green = 0; int alpha = 0; System.Random random = new System.Random(); red = random.Next(0, 255); blue = random.Next(0, 255); green = random.Next(0, 255); alpha = random.Next(0, 255); for (int i = 0; i < 307200; i++) { if ((i % 1) == 0) { pixelMatrix[i] = (byte)blue; // blue } if ((i % 2) == 0) { pixelMatrix[i] = (byte)green; // green } if ((i % 3) == 0) { pixelMatrix[i] = (byte)red; // red } if ((i % 4) == 0) { pixelMatrix[i] = (byte)alpha; // red } } LogitechGSDK.LogiLcdColorSetBackground(pixelMatrix); LogitechGSDK.LogiLcdColorSetText(6, "color : " + red + " - " + blue + " - " + green + " - " + alpha, 255, 0, 0); } if (Input.GetKey(KeyCode.Mouse1)) { //MONO TEST pixelMatrix = new byte[6880]; int pixel; for (int i = 0; i < 6880; i++) { System.Random random = new System.Random(); pixel = random.Next(0, 255); pixelMatrix[i] = (byte)pixel; // red } LogitechGSDK.LogiLcdMonoSetBackground(pixelMatrix); } }