Exemple #1
0
 /// <summary>
 /// Make a screen snapshot of the current state of the screenbuffer.
 /// </summary>
 public ScreenSnapShot(IScreenBuffer fromScreen)
 {
     Buffer = fromScreen.GetBuffer();
     TopRow = fromScreen.TopRow;
     CursorColumn = fromScreen.CursorColumnShow;
     CursorRow = fromScreen.CursorRowShow;
     RowCount = fromScreen.RowCount;
 }
Exemple #2
0
 /// <summary>
 /// Make a screen snapshot of the current state of the screenbuffer.
 /// </summary>
 public ScreenSnapShot(IScreenBuffer fromScreen)
 {
     Buffer       = fromScreen.GetBuffer();
     TopRow       = fromScreen.TopRow;
     CursorColumn = fromScreen.CursorColumnShow;
     CursorRow    = fromScreen.CursorRowShow;
     RowCount     = fromScreen.RowCount;
 }
Exemple #3
0
        void TerminalGui(int windowId)
        {
            if (!allTexturesFound)
            {
                GUI.Label(new Rect(15, 15, 450, 300), "Error: Some or all kOS textures were not found. Please " +
                          "go to the following folder: \n\n<Your KSP Folder>\\GameData\\kOS\\GFX\\ \n\nand ensure that the png texture files are there.");

                GUI.Label(closeButtonRect, "Close");

                return;
            }

            if (shared == null || shared.Screen == null)
            {
                return;
            }

            GUI.color = isLocked ? color : colorAlpha;
            GUI.DrawTexture(new Rect(10, 20, terminalImage.width, terminalImage.height), terminalImage);

            if (GUI.Button(closeButtonRect, "Close"))
            {
                Close();
                Event.current.Use();
            }

            GUI.DragWindow(new Rect(0, 0, 10000, 500));

            Color currentTextColor;

            if (IsPowered)
            {
                currentTextColor = isLocked ? textColor : textColorAlpha;
            }
            else
            {
                currentTextColor = isLocked ? textColorOff : textColorOffAlpha;
            }

            GUI.BeginGroup(new Rect(31, 38, 420, 340));

            IScreenBuffer screen = shared.Screen;
            List <char[]> buffer = screen.GetBuffer();

            for (int row = 0; row < screen.RowCount; row++)
            {
                char[] lineBuffer = buffer[row];
                for (int column = 0; column < screen.ColumnCount; column++)
                {
                    char c = lineBuffer[column];
                    if (c != 0 && c != 9 && c != 32)
                    {
                        ShowCharacterByAscii(c, column, row, currentTextColor);
                    }
                }
            }

            bool blinkOn = cursorBlinkTime < 0.5f &&
                           screen.CursorRowShow < screen.RowCount &&
                           IsPowered &&
                           showCursor;

            if (blinkOn)
            {
                ShowCharacterByAscii((char)1, screen.CursorColumnShow, screen.CursorRowShow, currentTextColor);
            }
            GUI.EndGroup();
        }