Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        int StoredPage = GameControl.control.LCDPage;

        if (GameControl.control.Shutdown == true)
        {
            LogitechGSDK.LogiLcdShutdown();
        }

        //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";
            GameControl.control.LCDPage--;
        }
        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";
            GameControl.control.LCDPage++;
        }
        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);

        if (GameControl.control.LCDPage < 0)
        {
            GameControl.control.LCDPage = 0;
        }

        if (GameControl.control.LCDPage != StoredPage)
        {
            for (int i = 0; i < 8; i++)
            {
                LogitechGSDK.LogiLcdColorSetText(i, "", 0, 0, 0);
            }
        }

        if (GameControl.control.ChangeColor == true)
        {
            Timer -= 1 * Time.deltaTime;

            if (Timer <= 0)
            {
                Timer = 1;
                RaveParty();
            }
        }

        LogitechGSDK.LogiLcdUpdate();
    }
Beispiel #2
0
        static void Main(string[] args)
        {
            // check and load config
            AppSettings loadedSettings = CheckandLoadConfig();

            listEntries = loadedSettings.Applications;


            // set settings
            titelColorR    = utils.HexToColor(loadedSettings.GlobalSettings.TitelColor).R;
            titelColorG    = utils.HexToColor(loadedSettings.GlobalSettings.TitelColor).G;
            titelColorB    = utils.HexToColor(loadedSettings.GlobalSettings.TitelColor).B;
            lineColorR     = utils.HexToColor(loadedSettings.GlobalSettings.LineColor).R;
            lineColorG     = utils.HexToColor(loadedSettings.GlobalSettings.LineColor).G;
            lineColorB     = utils.HexToColor(loadedSettings.GlobalSettings.LineColor).B;
            selectedColorR = utils.HexToColor(loadedSettings.GlobalSettings.SelectedEntryColor).R;
            selectedColorG = utils.HexToColor(loadedSettings.GlobalSettings.SelectedEntryColor).G;
            selectedColorB = utils.HexToColor(loadedSettings.GlobalSettings.SelectedEntryColor).B;
            prefixSelector = loadedSettings.GlobalSettings.PrefixSelector;
            suffixSelector = loadedSettings.GlobalSettings.SuffixSelector;
            debugOn        = loadedSettings.GlobalSettings.DebugMode;
            paddingLeft    = loadedSettings.GlobalSettings.paddingLeft;
            topOffset      = loadedSettings.GlobalSettings.topOffset;



            // check if already running
            Process[] pname = Process.GetProcessesByName(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
            if (pname.Length > 1)
            {
                Process currentProcess = Process.GetCurrentProcess();
                debugOn = true;
                WriteDebugMessage("App already running need to kill all other...");

                foreach (Process task in pname)
                {
                    if (task.Id != currentProcess.Id)
                    {
                        task.Kill();
                        WriteDebugMessage("Process ID: " + task.Id + " killed");
                    }
                }
                WriteDebugMessage("...Done, but manuel restart is neccessary, press any key to exit..");
                Console.ReadKey();
                Environment.Exit(1);
            }
            else
            {
                WriteDebugMessage("no other instance is running... start");
            }


            // init device
            InitDevice();



            // initial line numbers, indexe etc. for scrolling and paging

            displayLines = g19DisplayLines - topOffset;

            maxIndexNumber = listEntries.Count - 1;
            if (maxIndexNumber >= displayLines)
            {
                maxLineNumber = displayLines;
            }
            else
            {
                maxLineNumber = maxIndexNumber;
            }
            int indexNumber = -1;
            int lineNumber  = -1;
            int pageNumber  = 0;

            // load display entries
            InitDisplayEntries();

            // main loop
            while (1 == 1)
            {
                // set time or titel
                if (loadedSettings.GlobalSettings.ShowClockInsteadOfTitel)
                {
                    LogitechGSDK.LogiLcdColorSetTitle(DateTime.Now.ToShortTimeString(), titelColorR, titelColorG, titelColorB);
                }
                else
                {
                    LogitechGSDK.LogiLcdColorSetTitle(loadedSettings.GlobalSettings.AppTitle, titelColorR, titelColorG, titelColorB);
                }
                LogitechGSDK.LogiLcdUpdate();


                // go down button
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_DOWN) & noPageLock)
                {
                    // count line number until end of page (7)
                    if (lineNumber < maxLineNumber)
                    {
                        lineNumber += 1;
                    }
                    // jump to top
                    else if (lineNumber == maxIndexNumber)
                    {
                        lineNumber = 0;
                    }

                    // count index until max index
                    if (indexNumber == maxIndexNumber)
                    {
                        indexNumber = 0;
                        lineNumber  = 0;
                    }
                    else
                    {
                        indexNumber += 1;
                    }

                    WriteDebugMessage("-> DOWN <-- Line " + lineNumber + " index number:  " + indexNumber + " on Page " + pageNumber);

                    // go down on Page 0 or 1
                    if (pageNumber == 0)
                    {
                        Reorder(lineNumber, indexNumber, appNAME);
                    }
                    else
                    {
                        Reorder(lineNumber, indexNumber, appPATH);
                    }
                }

                // go up button
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_UP) & noPageLock)
                {
                    // discount line number until start page (0)
                    if (lineNumber > -1 & indexNumber <= maxLineNumber)
                    {
                        lineNumber += -1;
                    }

                    // discount until index or line -1
                    if (indexNumber == -1 | lineNumber == -1)
                    {
                        indexNumber = maxIndexNumber;
                        lineNumber  = maxLineNumber;
                    }
                    else
                    {
                        indexNumber += -1;
                    }

                    WriteDebugMessage("-> UP <-- Line " + lineNumber + " index number:  " + indexNumber + " on Page " + pageNumber);

                    // go up Page 0 or 1
                    if (pageNumber == 0)
                    {
                        Reorder(lineNumber, indexNumber, appNAME);
                    }
                    else
                    {
                        Reorder(lineNumber, indexNumber, appPATH);
                    }
                }

                // hit enter
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_OK) & noPageLock)
                {
                    WriteDebugMessage("-> OK <-- Line " + lineNumber);
                    SelectEntryOK(lineNumber);
                }

                // go back (left)
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_LEFT) | LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_CANCEL))
                {
                    WriteDebugMessage("-> BACK (left) <-- Line " + lineNumber);
                    pageNumber = 0;
                    Reorder(lineNumber, indexNumber, appNAME);
                    noPageLock = true;
                }

                // show path (right)
                if (LogitechGSDK.LogiLcdIsButtonPressed(LogitechGSDK.LOGI_LCD_COLOR_BUTTON_RIGHT) & noPageLock)
                {
                    WriteDebugMessage("-> SHOW PATH (right) <-- Line " + lineNumber);
                    Reorder(lineNumber, indexNumber, appPATH);
                    pageNumber = 1;
                }

                Thread.Sleep(100);
            }
        }
Beispiel #3
0
    // 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);
        }
    }