Exemplo n.º 1
0
        public void DrawLoop()
        {
            ConsoleEx.Cls();
            do {
                if (tn.GetScreenSafe().ChangedScreen) {

                    Tile[,] Screen = tn.GetScreenSafe().GetScreenUpdate();

                    for (int y = 0; y < Screen.GetLength(1); y++) {
                        for (int x = 0; x < Screen.GetLength(0); x++) {
                            Tile point = Screen[x, y];

                            if (point != null) {
                                if (point.Character == 8729) {
                                    point = new Tile((char)1, ConsoleColor.Black, ConsoleColor.Green);
                                }
                                ConsoleEx.QPrint(point.Character.ToString(), x, y, ConvertColor(point.ForeColor), ConvertColor(point.BackColor));
                            }
                        }
                    }
                }
            } while (true);
            // http://dwarffortresswiki.org/index.php/Character_table
        }
Exemplo n.º 2
0
 /// <summary>
 /// Write a byte to the screen, and set new cursor position.
 /// </summary>
 /// <remarks>
 /// Changes the output-flag!
 /// </remarks>
 /// <param name="writeChar">Output bytes</param>
 /// <returns>True if byte has been written</returns>
 public bool WriteCharacters(Tile[] writeChar)
 {
     if (writeChar==null || writeChar.Length < 1)
         return false;
     else
     {
         for (int i=0; i < writeChar.Length; i++)
         {
             if (!this.WriteCharacter(writeChar[i], true))
                 return false;
         }
         return true;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Write a byte to the screen.
 /// </summary>
 /// <remarks>
 /// Changes the output-flag!
 /// </remarks>
 /// <param name="writeChar">Output byte</param>
 /// <param name="moveCursor">Move the cursor or not</param>
 /// <returns>True if byte has been written</returns>
 public bool WriteCharacter(Tile writeChar, bool moveCursor = true)
 {
     if (vs == null) {
         return false;
     }  else {
         switch ((byte)writeChar.Character) {
             case 10:
                 // NL
                 this.CursorY0++;
                 break;
             case 13:
                 // CR
                 this.CursorX0 = 0;
                 break;
             default:
                 int y = CursorY0;
                 if (this.visibleAreaY0top > 0)
                     y -= this.visibleAreaY0top;
                 if (y >= 0) {
                     try {
                         this.vsupdated[CursorX0, y] = writeChar;
                         this.vs[CursorX0, y] = writeChar;
                     } catch {
                         // boundary problems should never occur, however
                     }
                 }
                 if (moveCursor)
                     this.MoveCursor(1);
                 break;
         }
         this.changedScreen = true;
     }
     return true;
 }