コード例 #1
0
ファイル: Surface.cs プロジェクト: rbua/JILK
        /// <summary>
        /// Redisplay all inner windows, sorts it by zIndex and builds new char matrix if required, and sets new stringified frame
        /// </summary>
        public void GenerateFrame()
        {
            if (Windows == null || Windows.Count == 0)
            {
                return;
            }
            if (Console.WindowWidth != width || Console.WindowHeight != height)
            {
                width          = Console.WindowWidth;
                height         = Console.WindowHeight;
                isStateChanged = true;
            }
            if (isStateChanged)
            {
                ScreenCharmap = new char[height, width];
            }

            Windows.Sort((win1, win2) => win1.Position.Z.CompareTo(win2.Position.Z));

            foreach (var window in Windows)
            {
                ScreenCharmap.AddInnerBitmap(window.Charmap, window.Position.X, window.Position.Y);
            }

            StringifyFrame();
        }